home *** CD-ROM | disk | FTP | other *** search
/ HamCall (April 1991) / HAMCALL CD-ROM (Buckmaster)(April 1991).BIN / telcom / telix / salt.doc < prev    next >
Text File  |  1988-10-09  |  221KB  |  6,770 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.       
  9.  
  10.       
  11.  
  12.       
  13.  
  14.       
  15.  
  16.       
  17.  
  18.       
  19.  
  20.       
  21.  
  22.       
  23.  
  24.       
  25.  
  26.       
  27.  
  28.       T E L I X
  29.  
  30.       --------------------------------------------------------------------
  31.  
  32.       SALT Programming Manual
  33.  
  34.       
  35.  
  36.                                         
  37.       
  38.  
  39.       
  40.  
  41.       
  42.  
  43.                                         
  44.                                         
  45.                                         
  46.                                         
  47.                    Copyright (C) 1986,1987,1988 by Exis Inc.
  48.                                         
  49.                               ALL RIGHTS RESERVED.
  50.                                         
  51.                                         
  52.                                    Exis Inc.
  53.                               Post Office Box 130
  54.                             West Hill, Ont. M1E 4R4
  55.           Telix v3.00 - SALT Programming               COPYRIGHT    ii
  56.  
  57.  
  58.  
  59.  
  60.       
  61.  
  62.       
  63.  
  64.                                 COPYRIGHT NOTICE
  65.  
  66.  
  67.       Telix is Copyright (c) 1986, 1987, 1988 by Exis Inc.
  68.  
  69.       This document is Copyright (c) 1988 by Exis Inc.
  70.  
  71.       No parts of Telix or this document may be copied in part or in
  72.       whole, except as provided in the License included with Telix.
  73.  
  74.       
  75.  
  76.       
  77.  
  78.                                    Disclaimer
  79.  
  80.  
  81.       Exis Inc. makes no warranty of any kind, either express or implied,
  82.       including but not limited to implied warranties of merchantability
  83.       and fitness for a particular purpose, with respect to this software
  84.       and accompanying documentation.
  85.  
  86.       IN NO EVENT SHALL EXIS INC. BE LIABLE FOR ANY DAMAGES (INCLUDING
  87.       DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
  88.       BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING OUT OF THE
  89.       USE OF OR INABILITY TO USE THIS PROGRAM, EVEN IF EXIS INC. HAS BEEN
  90.       ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  91.  
  92.       
  93.       
  94.       
  95.                                    Trademarks
  96.  
  97.  
  98.       Telix and SALT are trademarks of Exis Inc.
  99.           Telix v3.00 - SALT Programming               Contents    iii
  100.  
  101.  
  102.  
  103.  
  104.       
  105.  
  106.       
  107.       
  108.       
  109.       
  110.       
  111.       
  112.                                 C O N T E N T S
  113.       
  114.       
  115.       1 The Telix SALT Language..................................1
  116.       1.1  What Can be Accomplished With SALT?...................1
  117.       1.2  About This Manual.....................................1
  118.       1.3  Notation..............................................1
  119.       1.4  Creating SALT Programs................................1
  120.       
  121.       2 Syntax...................................................3
  122.       2.1  Comments..............................................4
  123.       
  124.       3 Program Structure........................................6
  125.       3.1  Variables.............................................6
  126.       3.2  Expressions and Operators.............................8
  127.       3.3  Functions............................................10
  128.       3.4  Statements...........................................11
  129.       3.4.1  The Expression statement...........................12
  130.       3.4.2  The If statement...................................12
  131.       3.4.3  The While statement................................14
  132.       3.4.4  The Do...While statement...........................15
  133.       3.4.5  The For statement..................................15
  134.       3.4.6  The Return statement...............................16
  135.       3.4.7  The Break statement................................17
  136.       3.4.8  The Continue statement.............................17
  137.       3.4.9  The Goto statement.................................18
  138.       
  139.       4 Built-in Functions......................................20
  140.       4.1  Quick Listing of Functions by Type...................21
  141.       4.2  Complete Function Reference..........................23
  142.       
  143.       5 System Variables.......................................111
  144.       
  145.       6 Appendix A - ASCII Character Set.......................130
  146.       
  147.       7 Appendix B - Extended Key Scan Codes...................131
  148.       
  149.       8 Appendix C - Color Values..............................132
  150.       
  151.           Telix v3.00 - SALT Programming            Introduction    1
  152.  
  153.  
  154.  
  155.  
  156.       
  157.  
  158.  
  159.       1.  THE TELIX SALT LANGUAGE
  160.  
  161.       Telix has a built-in programming language called SALT (Script
  162.       Application Language for Telix). SALT will allow you to perform al-
  163.       most any communications related applications with Telix. SALT looks
  164.       similar to the C language, however if you have used almost any
  165.       programming language (such as Pascal, BASIC, etc.), you should feel
  166.       quite at home with SALT. While SALT was designed to be easy to
  167.       learn, it is like most programming languages quite complete, so it
  168.       is recommended that you read this chapter thoroughly and study the
  169.       examples provided, as well as the sample SALT scripts included with
  170.       Telix.
  171.  
  172.  
  173.       1.1  What Can be Accomplished With SALT?
  174.  
  175.       Like a program in any programming language, a SALT program (also
  176.       called a 'script') is typically used to perform a needed task or
  177.       function. The task can range from the very simple to the very com-
  178.       plicated. For example, a SALT script can be linked to a dialing di-
  179.       rectory entry, so that when you have established a connection to
  180.       that service, it automatically sends your i.d. and password to the
  181.       remote service. A much more complicated SALT script is used as the
  182.       basis for the Host Mode included with Telix.
  183.  
  184.  
  185.       1.2  About This Manual
  186.  
  187.       This manual is basically a reference to the SALT programming lan-
  188.       guage. It is by no means a tutorial on programming in general. It is
  189.       assumed that the reader of this manual is at least familiar with
  190.       general programming concepts.
  191.  
  192.  
  193.       1.3  Notation
  194.  
  195.       Throughout this manual, certain words in examples and in the text
  196.       will be surrounded by angle brackets and italicized, for example,
  197.       <expression>. These words are not to be taken as literal text. they
  198.       stand for something else, such as a word, a group of words, or even
  199.       several lines of text. What these italicized words stand for will be
  200.       explained as they come up.
  201.  
  202.  
  203.       1.4  Creating SALT Programs
  204.  
  205.       A SALT script is basically a sequence of instructions for Telix to
  206.       follow, using a specific syntax. You may use any text editor to pro-
  207.       duce this script file, as long as its output is normal ASCII text
  208.       (this means that if you use your word processor, you must usually
  209.       explicitly tell it to write out the file using ASCII format and to
  210.       not embed any special codes in the file). You may give any name you
  211.           Telix v3.00 - SALT Programming            Introduction    2
  212.  
  213.  
  214.  
  215.  
  216.       wish to a SALT source file, although we recommend that you always
  217.       use the extension .SLT for clarity.
  218.  
  219.       Once you have written your script file and saved it to disk, it must
  220.       be compiled. The program CS.EXE included with Telix reads your
  221.       'source' script file, and compiles it to a form which Telix can
  222.       understand. The compiled script can then be loaded more quickly by
  223.       Telix, and is also usually smaller.
  224.  
  225.       To compile a script source file, type
  226.  
  227.            cs <pathname>
  228.            
  229.       while at the DOS prompt and then press Enter (or Carriage Return).
  230.       The CS.EXE program must be in the current directory or on the DOS
  231.       PATH. <pathname> is the name of the file to compile, and may include
  232.       the drive and directory as well as the filename. The output file is
  233.       written to the same name except that the extension .SLC is used.
  234.  
  235.       When the script compiler finds an error in your source file, it will
  236.       abort the compile process and give you the line number on which the
  237.       error occurred, as well as the type of error. The error should then
  238.       be fixed and the source re-compiled. This is repeated until the com-
  239.       piler detects no more errors in your source file.
  240.  
  241.       The compiled script can then be run in Telix using several methods.
  242.       It may be run using the 'Run script' command, as a command-line op-
  243.       tion when running Telix from DOS, as a linked script to a dialing
  244.       directory entry, or from another script. The first three methods are
  245.       described in the Telix manual, while the last is described later in
  246.       this manual.
  247.           Telix v3.00 - SALT Programming                  Syntax    3
  248.  
  249.  
  250.  
  251.  
  252.       
  253.  
  254.  
  255.       2.  SYNTAX
  256.  
  257.       Case is not important in command, function, and variable names. The
  258.       only time case matters is inside a string constant (e.g., "Hello" is
  259.       not the same string as "hello"). Whitespace (such as the space, the
  260.       tab, the Carriage Return, or the Line Feed character) is not impor-
  261.       tant. The script compiler does not care where you place items, so
  262.       that you may arrange the program as you see fit. For example,
  263.  
  264.            if (value == 1)
  265.              prints("value is equal to 1!");
  266.            else
  267.              prints("values is not equal to 1.");
  268.  
  269.       is equivalent to
  270.  
  271.            if (value == 1) prints("value is equal to 1!");
  272.            else            prints("value is not equal to 1");
  273.            
  274.       or even to
  275.  
  276.            if(value==1)prints("value is equal to 1!");else prints("value
  277.            is not equal to 1.");
  278.            
  279.       The only time whitespace matters is when it would split up key-words
  280.       or function name, or in a string. For example, the key-word 'while'
  281.       must not be split up if it is to be recognized. The same applies to
  282.       other key-words or function names. As well, there must be space be-
  283.       tween the letters of a command and other letters. For example,
  284.       'while' is not the same as 'whileabc'. In the interest of clarity,
  285.       it is recommended that you try to make your code easy to understand,
  286.       by indenting where appropriate, and by using space effectively.
  287.       There is no reason, for example, to put more than one statement on a
  288.       line, even if it is perfectly legal. A good example of program style
  289.       can be found by looking at the sample scripts included with Telix.
  290.  
  291.       A string constant is a sequence of ASCII characters enclosed in
  292.       quotes, for example, "Hello", "Good-bye", or "Telix". It is often
  293.       necessary for a string constant to include special characters that
  294.       can not easily be typed from the keyboard, or can not be easily dis-
  295.       played. This is done with something called the escape character,
  296.       which is the caret ('^') symbol. When the SALT compiler is reading a
  297.       string constant and comes to the '^' symbol, it replaces it with a
  298.       certain ASCII code based on the character following the ^. Transla-
  299.       tions are as follows:
  300.  
  301.            ^c        'c' is a letter. The Control representation of what-
  302.                      ever letter 'c' is, is inserted into the text. There-
  303.                      fore ^M represents Ctrl-M, ^j represents Ctrl-J, etc.
  304.                      Whether the letter 'c' is upper or lower case is not
  305.                      significant. Note that what is really happening here
  306.                      is that 64 is being subtracted from the value of 'c',
  307.           Telix v3.00 - SALT Programming                  Syntax    4
  308.  
  309.  
  310.  
  311.  
  312.                      so for example, the Escape character can be repre-
  313.                      sented as ^[.
  314.            ^^        An actual caret ('^') symbol is placed into the text.
  315.            ^"        An actual double quote symbol ('"') is placed into
  316.                      the text. If a string must contain a double quote
  317.                      symbol, this is how it has to be done. If the plain
  318.                      '"' symbol were to be used, the compiler would think
  319.                      that the string was terminated at that point. For ex-
  320.                      ample, the string "He said, ^"Hello^"." is translated
  321.                      to 'He said, "Hello".'.
  322.            ^'        An actual single quote symbol (''') is placed into
  323.                      the text.
  324.            ^nnn      'nnn' is up to 3 digits representing the ASCII value
  325.                      of the character which should be placed into the
  326.                      text. A maximum of three digits is read, or up to the
  327.                      first non-digit character. For example, the compiler
  328.                      would read in the string "S^65LT" and output the
  329.                      string "SALT", since 65 is the ASCII value of 'A'.
  330.                      Note that if nnn is less than 3 digits you may have
  331.                      to pad it with one or two leading zeros if there are
  332.                      digits immediately following it in the string, so
  333.                      that the wrong value is not read in. For example the
  334.                      string "^79 Park Avenue" would translate to "O Park
  335.                      Avenue" since 79 is the ASCII value of 'O'. If you
  336.                      actually wanted Ctrl-G (ASCII code 7) followed by "9
  337.                      Park Avenue", you would use the string "^0079 Park
  338.                      Avenue".
  339.       
  340.       An integer constant is a sequence of digits representing an integer
  341.       value in the range -2147483648 to 2147483647. An integer constant
  342.       must start with a digit from 0 to 9 or the negative sign (-) fol-
  343.       lowed by a digit. The following are all valid integer constants:
  344.  
  345.            10
  346.            -400067
  347.            999
  348.  
  349.       An integer constant may also be entered in hexadecimal form (base
  350.       16, where each digit may be from '0' to '9' or 'a' to 'f', to repre-
  351.       sent 16 values). Hex values must be preceded by '0x' for the com-
  352.       piler to interpret them as such, and case is not important. The fol-
  353.       lowing are all valid integer constants enter in hexadecimal form:
  354.  
  355.            0xff00
  356.            0Xa2
  357.            0x7D
  358.            0x1AbCdEf
  359.  
  360.  
  361.       2.1  CommentsA comment in a source file is text that does not affect
  362.       what the program does, and is meant purely for explaining or de-
  363.       scribing something. In a SALT source file, whenever the symbol // is
  364.       encountered on a line, all the characters from that point on until
  365.       the end of the line are considered to be a comment and are ignored.
  366.       For example:
  367.           Telix v3.00 - SALT Programming                  Syntax    5
  368.  
  369.  
  370.  
  371.  
  372.            prints("Hello");       // This line will print "Hello"
  373.            
  374.           Telix v3.00 - SALT Programming       Program Structure    6
  375.  
  376.  
  377.  
  378.  
  379.       
  380.  
  381.  
  382.       3.  PROGRAM STRUCTURE
  383.  
  384.       A SALT script has the following format:
  385.  
  386.            <global_variable_definition>
  387.                 ...
  388.            <global_variable_definition>
  389.            
  390.            <function_definition>
  391.            
  392.            <global_variable_definition>
  393.                 ...
  394.            <global_variable_definition>
  395.            
  396.            <Function_definitions>
  397.            
  398.                 ...
  399.            
  400.       and so on. Basically a script file consists of definition of global
  401.       variables (variables which are available to any part of the script
  402.       file after which they are defined, and function definitions
  403.       (functions are lines of code clustered together in a group, so that
  404.       they can be called by a name). A script file does not have to have
  405.       any global variables or functions, but to run it must at least have
  406.       one function called 'main'. The following, for example, is a com-
  407.       plete script file:
  408.       
  409.            main()
  410.            
  411.            {
  412.            
  413.             prints ("hello");
  414.            
  415.            }
  416.       
  417.       When compiled and run, this script would print the string "hello" to
  418.       the screen.
  419.       
  420.  
  421.       3.1  Variables
  422.  
  423.       A variable is a location in memory where something is stored. The
  424.       contents of a variable can be changed by program code (hence the
  425.       name). In SALT, there are two types of variables, integer variables,
  426.       and string variables. The former holds an integer value (e.g.,
  427.       485624, or -627), while the latter holds a text string (e.g.
  428.       "Telix", or "SCRIPT"). Depending on where it is defined, a variable
  429.       is either global or local. If a variable is global, it means that it
  430.       can be used by any part of the script after the point where it is
  431.       defined. If a variable is local, it means that it can only be used
  432.       by the part of the script to which it is 'local', for example, the
  433.       function inside which it is defined. A variable name can be up to 31
  434.           Telix v3.00 - SALT Programming       Program Structure    7
  435.  
  436.  
  437.  
  438.  
  439.       digits long, and may include the letters 'A' to 'Z' or 'a' to 'z',
  440.       the digits '0' to '9', or the underscore character (_). The name may
  441.       not start with a digit. For example, 'his_name2' and '_his_name2'
  442.       are legal as variable names, while '2his_name' is not.
  443.  
  444.       An integer variable is defined in the form
  445.  
  446.            int <varname>;
  447.            
  448.       where <varname> is the name to be given to the variable. An al-
  449.       ternate definition is
  450.  
  451.            int <varname1>, <varname2>, ..., <varnameN>;
  452.            
  453.       which allows you to define more than one integer variable in one
  454.       statement. An original value can be assigned to the integer variable
  455.       by using the form
  456.  
  457.            int <varname> = <int_const>;
  458.            
  459.       where <int_const> is an integer constant. Similarly, an original
  460.       value can be assigned in the multiple definition above by placing
  461.       the assignment before the comma. Some examples are:
  462.  
  463.            int maximum;
  464.            int start = 0;
  465.            int level, i, count = 20, loop;
  466.            
  467.       A string variable is defined in the form
  468.  
  469.            str <varname>[<max>];
  470.            
  471.       where <varname> is the name to be given to the variable. <max> is
  472.       the maximum number of characters that the string can hold, and must
  473.       be in the range of 0 to 32767. An alternate definition is
  474.  
  475.            str <varname>[<max>], <varname2>[<max>], ...,
  476.            <varnameN>[<max>];
  477.            
  478.       which allows you to define more than one string variable in a state-
  479.       ment. An original value can be assigned to the string variable by
  480.       using the form
  481.  
  482.            str <varname>[<max>] = <str_const>;
  483.            
  484.       where <str_const> is a string constant. Similarly, an original value
  485.       can be assigned in the multiple definition above by placing the as-
  486.       signment before the comma. Some examples are:
  487.  
  488.            str password[80];
  489.            str password[40] = "mypass", name[30];
  490.            
  491.       The string length field may be left empty if an original value is
  492.       specified, in which case the length of the string variable is as-
  493.       sumed to be that of the assigned text, e.g.
  494.           Telix v3.00 - SALT Programming       Program Structure    8
  495.  
  496.  
  497.  
  498.  
  499.            str name[] = "John";
  500.            
  501.       If a variable is outside of a function, it is global. If it is de-
  502.       fined inside a function, it is local to that function and will only
  503.       be recognized there. If a variable defined inside a function uses
  504.       the same name as a global variable, any reference to that name while
  505.       in the function will access the local variable. After the function
  506.       has completed, the local variable is removed and a reference to that
  507.       name will access the global variable.
  508.  
  509.  
  510.       3.2  Expressions and Operators
  511.  
  512.       An expression is a mixture of symbols which resolves to a value when
  513.       evaluated. In other words, an expression is basically a formula. An
  514.       expression can consist of constants, variables, function calls, and
  515.       operators. An expression can be very simple, or very complicated.
  516.       For example, some expressions are:
  517.  
  518.            10 + 3 - 5
  519.            9 * 7 / 63 - 30
  520.            result = 10 * max(a, b)
  521.            month >= 10
  522.            200
  523.            command == "bye"
  524.            prints("Hello")
  525.            
  526.       In an expression, the data being acted upon are constants, vari-
  527.       ables, and functions calls, while the operators (+, *, etc.) are the
  528.       symbols that do things with the data. There are many different oper-
  529.       ators, of which there are two basic types. Binary operators (such as
  530.       +, *, /) perform a calculation on the expression on either side of
  531.       them. Unary operators appear before a single expression and work on
  532.       that. The following table lists the operators available in SALT:
  533.  
  534.              Symbol      (Un/Bin)ary          What it is/does
  535.                -            unary             Arithmetic negation
  536.                !            unary             Logical NOT
  537.               not           unary             Logical NOT (alternate)
  538.                *            binary            Multiplication
  539.                /            binary            Division
  540.                %            binary            Remainder (Mod)
  541.                +            binary            Addition
  542.                -            binary            Subtraction
  543.                <            binary            Less than
  544.                >            binary            Grater than
  545.                <=           binary            Less than or equal to
  546.                >=           binary            Greater than or equal to
  547.                ==           binary            Equality
  548.                !=           binary            Inequality
  549.                &            binary            Bitwise AND
  550.                |            binary            Bitwise OR
  551.                ^            binary            Bitwise Exclusive OR
  552.                &&           binary            Logical AND
  553.               and           binary            Logical AND (alternate)
  554.           Telix v3.00 - SALT Programming       Program Structure    9
  555.  
  556.  
  557.  
  558.  
  559.                ||           binary            Logical OR
  560.                or           binary            Logical OR (alternate)
  561.                =            binary            Assignment
  562.       
  563.       Note that the hyphen symbol can be either an arithmetic negation or
  564.       a subtraction depending on its use. Note that '!' is equivalent to
  565.       'not', '&&' is equivalent to 'and', and '||' is equivalent to 'or'.
  566.       The first form is preferred as you do not have to leave whitespace
  567.       around it for the compiler to recognize it, but beginners may have
  568.       an easier time remembering the second form. Also, do not confuse the
  569.       '=' (assignment operator) with the '==' (equality operator). The
  570.       former is used to assign a value to a variable, while the latter is
  571.       used to compare two values. Assuming you have the two expressions,
  572.       <expr1> and <expr2>, <expr1> = <expr2> would assign one to the
  573.       other, while <expr1> == <expr2> would test the two to see if they
  574.       are equal. For example
  575.  
  576.            num = 10
  577.            
  578.       would assign the value 10 to the variable called 'num', while
  579.  
  580.            num == 10
  581.            
  582.       would resolve to a value of non-zero (TRUE) if num was equal to 10,
  583.       and 0 (FALSE) if num was not equal to 10. There is also a difference
  584.       between the Logical operators and the Bitwise operators. The Logical
  585.       operators (such as and, &&, or, ||, etc), work with TRUE or FALSE
  586.       values and result in a TRUE or FALSE value, while the Bitwise opera-
  587.       tors (&, |, ^) work with the actual bits of the data they are han-
  588.       dling. The Bitwise operators almost never have to be used in a Telix
  589.       script, unless it is needed to get at the actual bits in a data
  590.       byte.
  591.  
  592.       Every operator resolves to a value, which is the result of the
  593.       operation performed (e.g, 10 * 7 would resolve to 70). The condi-
  594.       tional or equality operators such as ==, >, <=, etc., resolve to  a
  595.       0 (FALSE)) or non-zero (TRUE) value based on the results of the ex-
  596.       pression. Even the assignment operator = resolves to a value. The
  597.       result of the expression
  598.  
  599.            num = 10
  600.            
  601.       would be 10.
  602.  
  603.       All the operators have something called precedence, which is their
  604.       importance, and determines the order in which they are evaluated.
  605.       For example, 7 + 3 * 9 is equal to 34, because 3 * 9 is evaluated
  606.       first, and then added to 7 (* has a higher precedence than +). All
  607.       the operators are listed below in order of decreasing precedence.
  608.       All the operators on the same line have the same precedence, and are
  609.       resolved in the order that they are encountered.
  610.           Telix v3.00 - SALT Programming       Program Structure    10
  611.  
  612.  
  613.  
  614.  
  615.            -  !
  616.            *  /  %
  617.            +  -
  618.            <  >  <=  >=
  619.            ==  !=
  620.            &
  621.            |
  622.            and  &&
  623.            or  ||
  624.            =
  625.            
  626.       If a certain evaluation order is required that does not follow these
  627.       rules of precedence, parentheses may be used. Thus, 99 + 1 * 10
  628.       equals 109, while (99 + 1) * 10 equals 1000.
  629.  
  630.       If you are writing an expression of any sort, and are not sure of
  631.       the exact precedence of the operators you are using, use paren-
  632.       theses!
  633.  
  634.  
  635.       3.3  Functions
  636.  
  637.       A function is a way of grouping together some lines of code. A Telix
  638.       script consists of one or more functions. There are quite a few
  639.       advantages to having functions:
  640.  
  641.            One function can be called from another, to do a certain task.
  642.            The calling function does not have to know anything about the
  643.            called function other than what it does. This allows a script
  644.            to be split up into modular units, and makes code writing and
  645.            debugging easier.
  646.  
  647.            As mentioned above, what a function does it private. This means
  648.            that data variables defined in a function are local to that
  649.            function, and therefore you do not have to worry about another
  650.            part of the script unintentionally modifying them.
  651.  
  652.            A library of functions can thus be built. Later, you do not
  653.            have to re-write old code.
  654.  
  655.       Functions are defined in the following format:
  656.  
  657.            <funcname>(<arg1>, <arg2>, ..., <argN>)
  658.            
  659.            {
  660.             <variable_def>
  661.                 ...
  662.             <variable_def>
  663.            
  664.             <statement>
  665.                 ...
  666.             <statement>
  667.            }
  668.            
  669.           Telix v3.00 - SALT Programming       Program Structure    11
  670.  
  671.  
  672.  
  673.  
  674.       <funcname> is the name of the function. It follows the same rules of
  675.       other identifiers in SALT. There can only be one function that uses
  676.       a given name, however.
  677.  
  678.       <arg1> through <argN> are the declarations of the arguments
  679.       (parameters) that have been passed to the function by its caller
  680.       (sometimes, to accomplish its task, a function needs to have some
  681.       values passed to it). Each argument is defined in the form <type>
  682.       <name> where <type> is 'int' or 'str', and <name> is the name it
  683.       should be called by. At present, a function is not allowed to have
  684.       more than 12 values passed to it.
  685.  
  686.       <variable_def> is a variable definition, as described in the above
  687.       section on that topic. Any number of variables may be declared at
  688.       this part of the function. All such variables will be local vari-
  689.       ables and available only to this function.
  690.  
  691.       <statement> is an actual line of code. There may be as many lines of
  692.       statements in the function as needed. The format of a statement is
  693.       described below. First though, here is an example of a complete
  694.       function:
  695.  
  696.            max ( int a, int b )
  697.            
  698.            {
  699.            
  700.             int result;
  701.            
  702.             if (a > b)
  703.              result = a;
  704.             else
  705.              result = b;
  706.            
  707.             return result;
  708.            
  709.            }
  710.       
  711.       This function returns the larger (maximum) of the two values passed
  712.       to it. It could have been written much more simply (without the use
  713.       of the variable), but was written this way so that all the function
  714.       elements would be there.
  715.  
  716.  
  717.       3.4  Statements
  718.  
  719.       A statement is the basic element of code. A statement ALWAYS ends
  720.       with a semicolon character (;). In any location where a statement is
  721.       acceptable, you may use a group of statements, by enclosing them all
  722.       in curly braces (more on this below). There are many types of state-
  723.       ments, including: expression, if, while, do...while, for, return,
  724.       break, continue, and goto statements. Each type has several differ-
  725.       ent parts.
  726.           Telix v3.00 - SALT Programming       Program Structure    12
  727.  
  728.  
  729.  
  730.  
  731.       3.4.1  The Expression statement
  732.  
  733.       The 'expression' statement is the simplest and most common type of
  734.       statement. Its format is
  735.  
  736.            <expression>;
  737.            
  738.       where <expression> is any expression. Example are:
  739.  
  740.            result = 20;
  741.            password = "Beef";
  742.            pause(20);
  743.            num = 20 * max(a, b);
  744.            
  745.       Do not forget the semicolon character at the end of the statement.
  746.       If you do, the compiler will think that the next statement is part
  747.       of the current one, and will report some unexpected error.
  748.  
  749.  
  750.       3.4.2  The If statement
  751.  
  752.       An 'if' statement is used when a statement or group of statements
  753.       should be evaluated only if a condition is true. The format for an
  754.       'if' statement is as follows:
  755.  
  756.            if (<expression>)
  757.              <statement>
  758.            
  759.       <statement> is any statement as described above and below (that is,
  760.       an expression, if, while, do...while, for, return, break, or con-
  761.       tinue statement), and will only be executed if <expression> eval-
  762.       uates to non-zero. By using curly braces around them, a whole group
  763.       of statements may be conditionally evaluated. Some examples are:
  764.  
  765.            if (result == -1)
  766.              prints("ERROR!");
  767.            
  768.            if (num_tries > maximum)
  769.              return 0;
  770.            
  771.            if (month > 10 && day < 20)
  772.             {
  773.              clear();
  774.              prints("In range.");
  775.              return 1;
  776.             }
  777.       
  778.       An alternate form of the if statement is:
  779.  
  780.            if (<expression>)
  781.              <statement1>
  782.            else
  783.              <statement2>
  784.            
  785.           Telix v3.00 - SALT Programming       Program Structure    13
  786.  
  787.  
  788.  
  789.  
  790.       In this case, if <expression> evaluates to non-zero (TRUE),
  791.       <statement1> is executed, otherwise <statement2> is executed. Again,
  792.       multiple statements may be used instead by grouping them in curly
  793.       braces. Some examples are:
  794.  
  795.            if (stat == -1)
  796.              prints("Error status returned.");
  797.            else
  798.              prints("Function finished without problems.");
  799.            
  800.            if (level < 10)
  801.             {
  802.              alarm(1);
  803.              prints("Warning!");
  804.             }
  805.            else
  806.              prints("Everything's ok.");
  807.            
  808.       Since the statement to be executed conditionally can be of any type,
  809.       that means that any number of if statement can be nested if needed.
  810.       For example:
  811.  
  812.            if (num < 10)
  813.              if (!error)
  814.                if (read != 0)
  815.                  return 1;
  816.            
  817.       This also means that something like the following is legal:
  818.  
  819.            if (value == 10)
  820.              do_this();
  821.            else if (value == 100)
  822.              do_that();
  823.            else if (value == 1000)
  824.              do_something_else();
  825.            else
  826.              do_whatever();
  827.            
  828.       What is really happening here is that each if statement is being
  829.       nested after the else portion of the previous one. The above example
  830.       could also be written as:
  831.  
  832.            if (value == 10)
  833.              do_this();
  834.            else
  835.              if (value == 100)
  836.                do_that();
  837.              else
  838.                if (value == 1000)
  839.                  do_something_else();
  840.                else
  841.                  do_whatever();
  842.            
  843.       Any amount of nesting is theoretically legal, but the compiler does
  844.       have a limit due to memory constraints.
  845.           Telix v3.00 - SALT Programming       Program Structure    14
  846.  
  847.  
  848.  
  849.  
  850.       While you may write the code in any way which suits you, it is
  851.       recommended that you use indenting, for clarity. Indenting your code
  852.       at the proper places makes it a lot easier to read.
  853.  
  854.       A very common error to watch out for is accidentally placing a semi-
  855.       colon after the parenthesis ending the expression. For example, if
  856.       the following is run:
  857.  
  858.            if (num == 10);
  859.              prints("Num is equal to 10);
  860.            
  861.       the string would always be printed, no matter what num was equal to.
  862.       This is because the semicolon after the parenthesis ending the
  863.       expression signifies the end of the statement. In the above case, it
  864.       would just be a null (empty) statement.
  865.  
  866.  
  867.       3.4.3  The While statement
  868.  
  869.       The while statement is used to loop continuously while a certain
  870.       condition is true. It has the form
  871.  
  872.            while (<expression>)
  873.              <statement>
  874.            
  875.       <statement> would continue to be repeated over and over while
  876.       <expression> evaluated to non-zero (TRUE). Note that if the ex-
  877.       pression evaluates to 0 (FALSE) from the beginning, the statement
  878.       will never be executed. Again, multiple statements may be used by
  879.       surrounding them in curly braces. A few examples are:
  880.  
  881.            while (stat != -1)
  882.              stat = myfunc();
  883.            
  884.            while (num < 100)
  885.              {
  886.               printn(num);
  887.               prints("");
  888.               num = num + 1;
  889.              }
  890.            
  891.            while (1)
  892.              {
  893.               if (func1())
  894.                 return 0;
  895.            
  896.               func2();
  897.              }
  898.            
  899.       Again, be careful to not place a semicolon after the parenthesis
  900.       ending the expression.
  901.           Telix v3.00 - SALT Programming       Program Structure    15
  902.  
  903.  
  904.  
  905.  
  906.       3.4.4  The Do...While statement
  907.  
  908.       The do...while statement is similar to the while statement and has
  909.       the form:
  910.  
  911.            do
  912.              <statement>
  913.            while (<expression>);
  914.            
  915.       <statement> will be executed at least once and will continue to be
  916.       executed repeatedly until the expression becomes 0 (FALSE). A few
  917.       examples are:
  918.  
  919.            do
  920.              stat = func1();
  921.            while (stat != -1);
  922.            
  923.            do
  924.             {
  925.              prints("hello");
  926.              num = num + 1;
  927.             }
  928.            while (num < 100);
  929.       
  930.  
  931.       3.4.5  The For statement
  932.  
  933.       The for statement is used to loop continuously while a certain
  934.       condition is true. The advantages over the while statement is that a
  935.       count variable can be initialized and incremented quite easily. The
  936.       for statement has the form:
  937.  
  938.            for (<expression1>; <expression2>; <expression3>)
  939.              <statement>
  940.            
  941.       The first expression is the one that should initialize the count
  942.       variable. For example, if you wanted to count from 1 to 100, and
  943.       were keeping the count in a variable called 'num', the first ex-
  944.       pression would be 'num = 1'. The second expression is the condi-
  945.       tional test. As long as it evaluates to non-zero (TRUE), the state-
  946.       ment will be executed. Following the above example, this expression
  947.       would be 'num < 100'. The third expression is the one that is used
  948.       to increment the count variable. For the above example, it would
  949.       therefore be 'num = num + 1'. This for statement differs in format
  950.       from that in most other languages, but doing it this way is actually
  951.       gives the programmer a lot of power and flexibility. Note that any
  952.       of the expressions can be left empty, in which case they evaluate to
  953.       non-zero (TRUE). Some examples are:
  954.  
  955.            for (count = 0; count < 100; count = count + 1)
  956.             {
  957.              printn(count);
  958.              prints("");
  959.             }
  960.            
  961.           Telix v3.00 - SALT Programming       Program Structure    16
  962.  
  963.  
  964.  
  965.  
  966.            for (c = 1000; c > 0; c = c - 1)
  967.              do_this(c);
  968.            
  969.       The following would execute an infinite loop:
  970.  
  971.            for (;;)
  972.              prints("Hello!");
  973.            
  974.       Note that there is really no restriction on what the expressions
  975.       are. For example, the following is quite legal:
  976.  
  977.            for (c = num = 0; c < 100 && stat != -1; c = c + 1)
  978.              {
  979.               stat = func(num);
  980.               num = func2();
  981.              }
  982.            
  983.       The statements would only be executed if c was smaller than 100 and
  984.       stat didn't equal -1.
  985.       
  986.  
  987.       3.4.6  The Return statement
  988.  
  989.       At some time, every function must be exited. If the end of the func-
  990.       tion is reached, control will automatically return to the calling
  991.       function. Very often however, it is necessary to leave a function
  992.       somewhere while only halfway through it, perhaps based on a condi-
  993.       tional test. As well, it is often necessary that a function returns
  994.       a value to the caller. The format of the return statement is:
  995.  
  996.            return <expression>;
  997.  
  998.       If the return statement is encountered anywhere in the function,
  999.       control immediately returns to the function that called this func-
  1000.       tion. The expression is the value that should be returned. If no ex-
  1001.       pression is supplied, a dummy value is returned. The expression
  1002.       should match they type of value that the caller of this function is
  1003.       expecting. That is, if an 'int' type is expected, the expression
  1004.       should resolve to an integer value. If a 'str' type is expected, the
  1005.       expression should resolve to a string value. Due to memory con-
  1006.       straints, a local string variable may NOT be returned from a func-
  1007.       tion. Some examples are:
  1008.  
  1009.            return;
  1010.            return 1;
  1011.            return level;
  1012.            return (sum + 25);
  1013.            return "hello";
  1014.            return (func() + 20);
  1015.            
  1016.       Notice that when a complex expression is returned it is usually sur-
  1017.       rounded by parentheses. This is done only for clarity and is not
  1018.       necessary. Also, it should be clear that what is returned is not the
  1019.       expression but what it evaluates to.
  1020.           Telix v3.00 - SALT Programming       Program Structure    17
  1021.  
  1022.  
  1023.  
  1024.  
  1025.       3.4.7  The Break statement
  1026.  
  1027.       Often while using a looping statement (while, do...while, for), it
  1028.       is necessary to break out of (exit) the loop. The break statement
  1029.       serves this purpose. When the break statement is encountered, execu-
  1030.       tion of the smallest while, do...while, or for loop is terminated,
  1031.       and execution continues immediately after the terminated loop state-
  1032.       ment. It is an error for a break statement to appear outside of a
  1033.       loop. The format of the break statement is:
  1034.  
  1035.            break;
  1036.  
  1037.       For example, assuming you had the following code:
  1038.  
  1039.            int num = 0;
  1040.            while (1)
  1041.             {
  1042.              num = num + 1;
  1043.              if (num > 100)
  1044.                break;
  1045.             }
  1046.            prints("Done");
  1047.  
  1048.       Ordinarily, since there will always be a non-zero (TRUE) value in
  1049.       the conditional part of this while statement, it would execute for-
  1050.       ever. However, when the 'num' variable is > 100, the break statement
  1051.       is executed to exit from the loop, at which point the next statement
  1052.       would be executed (the function call to prints).
  1053.  
  1054.  
  1055.       3.4.8  The Continue statement
  1056.  
  1057.       The continue statement is used within a loop (while, do...while, or
  1058.       for statement). The continue statement has the form:
  1059.  
  1060.            continue;
  1061.  
  1062.       It is illegal for a continue statement to appear outside of a loop
  1063.       body. When a continue statement is encountered, program control is
  1064.       immediately transferred to the end of the body of the innermost en-
  1065.       closing while, do...while, or for statement. The effect in a while
  1066.       or do...while statement is that the condition part of the while or
  1067.       do...while statement is evaluated, and the next iteration of the
  1068.       loop occurs. For example:
  1069.  
  1070.            num = 0;
  1071.            while (num < 100000)
  1072.             {
  1073.              num = num + 1;
  1074.              if (num > 100)
  1075.               continue;
  1076.              prints("Hello");
  1077.             }
  1078.            
  1079.           Telix v3.00 - SALT Programming       Program Structure    18
  1080.  
  1081.  
  1082.  
  1083.  
  1084.       The effect of the continue statement in the above loop would be that
  1085.       'Hello' would only be printed while 'num' was smaller or equal to
  1086.       100, as the continue statement is executed when num is bigger than
  1087.       100, which causes the rest of the loop body to be skipped. An ex-
  1088.       ample for statement would be:
  1089.  
  1090.            for (num = 0; num < 100000; num = num + 1)
  1091.             {
  1092.              if (num > 100)
  1093.               continue;
  1094.              prints("Hello");
  1095.             }
  1096.            
  1097.       The effect in this case would be the same. While 'num' is smaller or
  1098.       equal to 100, the entire loop body executes. If 'num' is greater
  1099.       than 100 however, the continue statement is executed. This causes
  1100.       the rest of the loop body to be skipped, so the 'Hello' is then not
  1101.       printed.
  1102.  
  1103.       3.4.9  The Goto statement
  1104.  
  1105.       The goto statement is used to branch (jump) from one place to an-
  1106.       other, within a function. The use of goto statements is considered
  1107.       bad style. They can make code very hard to understand, and are in
  1108.       fact almost never necessary. For example, Telix is written mainly in
  1109.       the C language, which has a goto statement, yet except for a few
  1110.       pieces of pre-written code, the goto statement was never used nor
  1111.       needed. On the other hand, used very sparingly and properly, it can
  1112.       sometimes make some code clearer and perhaps faster. The goto state-
  1113.       ment consists of two parts, the 'label' or marker, which is where
  1114.       execution will jump to, and the actual goto itself. A label is de-
  1115.       fined in the form
  1116.  
  1117.            <identifier>:
  1118.  
  1119.       where <identifier> follows the same rules as for variable names.
  1120.       Note that a colon follows the name, not a semicolon. The colon char-
  1121.       acter must immediately follow the label name, with no intervening
  1122.       spaces. A label does not have to be on a line by itself, and is not
  1123.       considered a statement by itself. The goto takes the form
  1124.  
  1125.            goto <label>;
  1126.  
  1127.       where <label> is a label elsewhere in the function defined as de-
  1128.       scribed above. Execution of the script will immediately continue
  1129.       following the label.
  1130.  
  1131.       An example is:
  1132.  
  1133.            start:
  1134.            prints("Hello");
  1135.            goto start;
  1136.            
  1137.           Telix v3.00 - SALT Programming       Program Structure    19
  1138.  
  1139.  
  1140.  
  1141.  
  1142.       This would print the word "hello" over and over, forever. There is
  1143.       no restriction on the placement of a label, so the above can be
  1144.       written as:
  1145.  
  1146.            start: prints("Hello");
  1147.            goto start;
  1148.  
  1149.       As mentioned above, there are usually better ways than using a goto
  1150.       statement. For example:
  1151.  
  1152.            int i = 0;
  1153.            do
  1154.             i = i + 1;
  1155.            while (i < 100);
  1156.            
  1157.       is clearer than the equivalent:
  1158.  
  1159.            int i = 0;
  1160.            loop:
  1161.             i = i + 1;
  1162.             if (i < 100)
  1163.              goto loop;
  1164.            
  1165.       One good use of a goto statement is to get out of a deeply nested
  1166.       while statements, without having to do a lot of extra checking.
  1167.           Telix v3.00 - SALT Programming      Built-in Functions    20
  1168.  
  1169.  
  1170.  
  1171.  
  1172.       4.  BUILT-IN FUNCTIONS
  1173.  
  1174.       Telix has quite a large number of built-in functions. These func-
  1175.       tions are called just as you would call your own SALT functions.
  1176.       Each function does a certain task (print something to the screen,
  1177.       manipulate strings, access disk files, etc.). Each function is
  1178.       called with parameters in a certain format and returns an integer or
  1179.       string value (the return value does not have to be used and is often
  1180.       a dummy variable).
  1181.  
  1182.       The following pages contain a quick listing of the functions by type
  1183.       followed by a complete description of each function, in alphabetical
  1184.       order. The complete reference contains for each function, a summary
  1185.       of the calling format, a description of what it does, and the return
  1186.       value of the function are all given. An example of actual usage of
  1187.       the function is often be given. So that you may find related func-
  1188.       tions, each function description has a 'See Also' section, which
  1189.       lists related functions.
  1190.           Telix v3.00 - SALT Programming      Built-in Functions    21
  1191.  
  1192.  
  1193.  
  1194.  
  1195.       
  1196.  
  1197.       4.1  Quick Listing of Functions by Type
  1198.  
  1199.       Video Operations
  1200.  
  1201.       box, cursor_onoff, clear_scr, getx, gety, gotoxy, printc, printn,
  1202.       prints, printsc, pstra, pstraxy, scroll, status_wind, update_term
  1203.  
  1204.       String Handling
  1205.  
  1206.       copychrs, copystr, delchrs, gets, getsxy, inschrs, itos, setchr,
  1207.       setchrs, stoi, strcat, strchr, strcmpi, strlen, strlower, strmaxlen,
  1208.       strpos, strposi, strupper, subchr, subchrs, substr
  1209.  
  1210.       Character Handling
  1211.  
  1212.       isascii, isalnum, isalpha, iscntrl, isdigit, islower, isupper,
  1213.       tolower, toupper
  1214.  
  1215.       Comm Port Operations
  1216.  
  1217.       carrier, cinp_cnt, cgetc, cgetct, cputc, cputs, cputs_tr, flushbuf,
  1218.       get_baud, get_datab, get_parity, get_port, get_stopb, hangup,
  1219.       set_cparams, set_port
  1220.  
  1221.       File and File I/O Operations
  1222.  
  1223.       fclearerr, fclose, ferror, feof, fflush, fgetc, fgets, fileattr,
  1224.       filefind, filesize, filetime, fnstrip, fopen, fputc, fputs, fread,
  1225.       fseek, ftell, fwrite
  1226.  
  1227.       Keyboard Operations
  1228.  
  1229.       inkey, inkeyw, keyget, keyload, keysave, keyset
  1230.  
  1231.       Date/Time and Timer Operations
  1232.  
  1233.       curtime, date, tsec, tday, thour, time, time_up, timer_free,
  1234.       timer_restart, timer_start, timer_total, tmin, tmonth, tyear
  1235.  
  1236.       File Transfers, Capture, Printer, and Usage Log
  1237.  
  1238.       capture, printer, receive, send, transtab, usagelog, ustamp
  1239.  
  1240.       Script Management
  1241.  
  1242.       call, calld, delay_scr, is_loaded, load_scr, unload_scr
  1243.  
  1244.       Input String Matching
  1245.  
  1246.       track, track_addchr, track_free, track_hit, waitfor
  1247.  
  1248.       Other Functions
  1249.           Telix v3.00 - SALT Programming      Built-in Functions    22
  1250.  
  1251.  
  1252.  
  1253.  
  1254.       alarm, chatmode, delay, dial, dos, dosfunction, exittelix, help-
  1255.       screen, loadfon, newdir, redial, redirect_dos, run, send_brk,
  1256.       set_defprot, set_terminal, show_directory, terminal, tone
  1257.           Telix v3.00 - SALT Programming      Built-in Functions    23
  1258.  
  1259.  
  1260.  
  1261.  
  1262.       
  1263.  
  1264.       4.2  Complete Function Reference
  1265.  
  1266.                                                                              _________________________________________________________________
  1267.  
  1268.       alarm
  1269.  
  1270.       o  Summary
  1271.  
  1272.       alarm(int <seconds>);
  1273.  
  1274.       o  Description
  1275.  
  1276.       The alarm functions sounds an alarm for a a duration in seconds
  1277.       given by <seconds>.
  1278.  
  1279.       o  Return Value
  1280.  
  1281.       The <seconds> argument is returned.
  1282.  
  1283.       o  See Also
  1284.  
  1285.       tone
  1286.  
  1287.       o  Example
  1288.  
  1289.       while (!inkey())
  1290.         alarm(1);
  1291.           Telix v3.00 - SALT Programming      Built-in Functions    24
  1292.  
  1293.  
  1294.  
  1295.  
  1296.                                                                              _________________________________________________________________
  1297.  
  1298.       box
  1299.  
  1300.       o  Summary
  1301.  
  1302.       box(int <x>, int <y>, int <x2>, int <y2>, int <style>, int <hollow>,
  1303.       int <color>);
  1304.  
  1305.       o  Description
  1306.  
  1307.       The box function is used to create a box on the screen. The box will
  1308.       have an upper left hand corner of <x>,<y> and a lower right hand
  1309.       corner of <x2>,<y2>. The box must fit within the confines of the
  1310.       screen. <color> is the color to use in drawing the box. If <hollow>
  1311.       is a non-zero (TRUE) value, the inside of the box is not cleared.
  1312.       <style> selects what kind of box to draw, as follows:
  1313.  
  1314.            0    Spaces
  1315.            1    Single lines
  1316.            2    Double lines
  1317.            3    Single vertical lines, double horizontal lines
  1318.            4    Double vertical lines, single horizontal lines
  1319.  
  1320.       If <style> is any other value, that character is used to construct
  1321.       the sides of the box.
  1322.  
  1323.       o  Return Value
  1324.  
  1325.       None.
  1326.  
  1327.       o  See Also
  1328.  
  1329.       scroll
  1330.  
  1331.       o  Example
  1332.  
  1333.       box(10, 10, 70, 20, 1, 0, 112);    // draw box in inverse color
  1334.           Telix v3.00 - SALT Programming      Built-in Functions    25
  1335.  
  1336.  
  1337.  
  1338.  
  1339.                                                                              _________________________________________________________________
  1340.  
  1341.       call, calld
  1342.  
  1343.       o  Summary
  1344.  
  1345.       call(str <scriptname>, <arg1>, <arg2>, <arg3>, ...);
  1346.  
  1347.       calld(str <scriptname>, <arg1>, <arg2>, <arg3>, ...);
  1348.  
  1349.       o  Description
  1350.  
  1351.       The call function is used when one script file must call (jump into
  1352.       and then return from) another. <scriptname> is the name of the
  1353.       script file to call. If no extension is given, .SLC is assumed.
  1354.       <arg1> through <argn> are the arguments or parameters to be passed
  1355.       to the 'main' function of the called script. The value returned is
  1356.       the value returned by the 'main' function of the called script, and
  1357.       can be an integer or a string value, although the called script can
  1358.       not return string variables local to itself. If the script file to
  1359.       be called is already in memory because it was previously loaded and
  1360.       made resident, or it is still executing from a previous call, it is
  1361.       not released but instead the memory image is used. This means that
  1362.       global variables will have whatever values a previous run through
  1363.       left in them.
  1364.  
  1365.       The calld function is exactly the same as the call function, except
  1366.       that even if an image of the indicated script file is already in
  1367.       memory, a new copy is still loaded from disk. This ensures that
  1368.       global variables within the script will be set as defined in the
  1369.       source file, and that there will be enough stack space, but requires
  1370.       more memory and is slower.
  1371.  
  1372.       o  Return Value
  1373.  
  1374.       An integer or string value representing the value returned by the
  1375.       main function of the called script file. This value must not be a
  1376.       string variable defined within the called script, for memory rea-
  1377.       sons. if the indicated script can not be found or loaded, a value of
  1378.       -1 is returned. If the called script is aborted by the user, a value
  1379.       of -1 is returned.
  1380.  
  1381.       o  See Also
  1382.  
  1383.       load_scr, unload_scr, is_loaded
  1384.  
  1385.       o  Example
  1386.  
  1387.       stat = call("TEST");
  1388.       if (stat == -1)
  1389.        prints("Called script could not be loaded or was aborted!");
  1390.           Telix v3.00 - SALT Programming      Built-in Functions    26
  1391.  
  1392.  
  1393.  
  1394.  
  1395.                                                                              _________________________________________________________________
  1396.  
  1397.       capture
  1398.  
  1399.       o  Summary
  1400.  
  1401.       capture(str <filename>);
  1402.  
  1403.       o  Description
  1404.  
  1405.       The capture function is used to open, close, pause, and unpause the
  1406.       Telix capture file. Depending on what the string variable <filename>
  1407.       contains, different actions will take place.
  1408.  
  1409.       If <filename> contains a valid filename (which can include a path),
  1410.       Telix opens and starts capturing data to that file.
  1411.  
  1412.       If <filename> is "*CLOSE*", and the capture file is currently open,
  1413.       it is closed.
  1414.  
  1415.       If <filename> is "*PAUSE*", and the capture file is currently open,
  1416.       it is paused.
  1417.  
  1418.       if <filename> is "*UNPAUSE*", and the capture file is currently open
  1419.       and paused, it is unpaused.
  1420.  
  1421.       If <filename> is an empty string (""), Telix takes the same action
  1422.       as if the user had pressed Alt-L while in terminal mode (which will
  1423.       depend on whether the capture file is currently open or closed).
  1424.  
  1425.       o  Return Value
  1426.  
  1427.       A value of -1 is returned if there is a problem performing the indi-
  1428.       cated function, otherwise a non-zero (TRUE) value is returned.
  1429.  
  1430.       o  See Also
  1431.  
  1432.       image, printer
  1433.  
  1434.       o  Example
  1435.  
  1436.       if (capture("TELIX.CAP") == -1)
  1437.        prints("Error opening capture file!");
  1438.           Telix v3.00 - SALT Programming      Built-in Functions    27
  1439.  
  1440.  
  1441.  
  1442.  
  1443.                                                                              _________________________________________________________________
  1444.  
  1445.       capture_stat
  1446.  
  1447.       o  Summary
  1448.  
  1449.       capture_stat();
  1450.  
  1451.       o  Description
  1452.  
  1453.       The capture_stat function returns an integer value representing the
  1454.       current status of the capture file, as follows:
  1455.  
  1456.                 0    Capture File is closed
  1457.                 1    Capture File is open
  1458.                 2    Capture File is open and paused
  1459.  
  1460.       o  Return Value
  1461.  
  1462.       An integer values as described above.
  1463.  
  1464.       o  See Also
  1465.  
  1466.       usage_stat
  1467.  
  1468.                                                                              _________________________________________________________________
  1469.  
  1470.       carrier
  1471.  
  1472.       o  Summary
  1473.  
  1474.       carrier();
  1475.  
  1476.       o  Description
  1477.  
  1478.       The carrier functions returns a non-zero (TRUE) value if the Carrier
  1479.       Detect signal coming from the modem is on (high), otherwise it re-
  1480.       turns a zero (FALSE) value. Note that some modems by default over-
  1481.       ride the real state of the signal and always send a high. For this
  1482.       function to work, the modem must be told to supply the real signal.
  1483.       This function may be used to check if Telix is connected to a remote
  1484.       service over the modem, as the Carrier Detect signal should be on if
  1485.       there is a connection. Note that if you are connecting two computers
  1486.       via a null-modem cable, the value returned will depend on the wiring
  1487.       of the cable being used.
  1488.  
  1489.       o  Return Value
  1490.  
  1491.       non-zero (TRUE) or zero (FALSE) based on the state of the Carrier
  1492.       Detect signal.
  1493.  
  1494.       o  Example
  1495.  
  1496.       if (carrier())
  1497.        prints("We are online.");
  1498.           Telix v3.00 - SALT Programming      Built-in Functions    28
  1499.  
  1500.  
  1501.  
  1502.  
  1503.                                                                              _________________________________________________________________
  1504.  
  1505.       chatmode
  1506.  
  1507.       o  Summary
  1508.  
  1509.       chatmode(int <echo_remote>);
  1510.  
  1511.       o  Description
  1512.  
  1513.       The chatmode function enters the chat mode as if the user had
  1514.       pressed Alt-Y while in terminal mode, If <echo_remote> is non-zero
  1515.       (TRUE), characters typed by the remote user are echoed back to
  1516.       him/her, otherwise they are not. The echo feature is for use in Host
  1517.       Mode implementations.
  1518.  
  1519.       o  Return Value
  1520.  
  1521.       None.
  1522.  
  1523.                                                                              _________________________________________________________________
  1524.  
  1525.       cinp_cnt
  1526.  
  1527.       o  Summary
  1528.  
  1529.       cinp_cnt();
  1530.  
  1531.       o  Description
  1532.  
  1533.       The cinp_cnt function returns the number of characters waiting in
  1534.       the received data communications buffer.
  1535.  
  1536.       o  Return Value
  1537.  
  1538.       An integer value as described above.
  1539.  
  1540.       o  See Also
  1541.  
  1542.       cgetc
  1543.  
  1544.       o  Examples
  1545.  
  1546.       if (cinp_cnt() > 10)   // if more than 10 chars waiting
  1547.        handle_stuff();       //   do action
  1548.  
  1549.       while (!cinp_cnt())    // loop until no chars available
  1550.        ;
  1551.  
  1552.       if (cinp_cnt())        // if something available, get it
  1553.        c = cgetc();
  1554.           Telix v3.00 - SALT Programming      Built-in Functions    29
  1555.  
  1556.  
  1557.  
  1558.  
  1559.                                                                              _________________________________________________________________
  1560.  
  1561.       cgetc, cgetct
  1562.  
  1563.       o  Summary
  1564.  
  1565.       cgetc();
  1566.  
  1567.       cgetct(int <timeout>);
  1568.  
  1569.       o  Description
  1570.  
  1571.       The cgetc function returns the first character waiting in the re-
  1572.       ceived data communications buffer. If there are no characters in the
  1573.       buffer, a value of -1 is returned. The cinp_cnt function may be used
  1574.       to see if there are any chars waiting in the buffer.
  1575.  
  1576.       The cgetct functions returns a character from the communications
  1577.       port, waiting up to <timeout> tenths of a second for it to arrive.
  1578.       If a character is already waiting in the communications buffer, it
  1579.       is immediately returned. If no character is received within the
  1580.       timeout period, a value of -1 is returned.
  1581.  
  1582.       o  Return Value
  1583.  
  1584.       An integer value as described above.
  1585.  
  1586.       o  See Also
  1587.  
  1588.       cinp_cnt
  1589.  
  1590.       o  Example
  1591.  
  1592.       if (cinp_cnt())
  1593.        chr = cgetc();
  1594.  
  1595.       if ((chr = cgetct(100)) == -1)
  1596.        prints("Timeout!");
  1597.           Telix v3.00 - SALT Programming      Built-in Functions    30
  1598.  
  1599.  
  1600.  
  1601.  
  1602.                                                                              _________________________________________________________________
  1603.  
  1604.       clear_scr
  1605.  
  1606.       o  Summary
  1607.  
  1608.       clear_scr();
  1609.  
  1610.       o  Description
  1611.  
  1612.       The clear_scr function clears the screen and places the cursor in
  1613.       the upper left corner at position 0,0.
  1614.  
  1615.       o  Return Value
  1616.  
  1617.       None.
  1618.  
  1619.       o  See Also
  1620.  
  1621.       scroll
  1622.  
  1623.                                                                              _________________________________________________________________
  1624.  
  1625.       copychrs
  1626.  
  1627.       o  Summary
  1628.  
  1629.       copychrs(str <source>, int <target>, int <pos>, int <count>);
  1630.  
  1631.       o  Description
  1632.  
  1633.       The copychrs function copies a number of characters from one string
  1634.       into another, Characters from the string <source> are copied into
  1635.       the string <target> at the position <pos> (note that SALT string
  1636.       offsets start at 0, not 1 as in some languages). until <count> char-
  1637.       acters are copied. Only as many characters as will fit in <target>
  1638.       are copied.
  1639.  
  1640.       This function is very similar to substr, except that it is not
  1641.       string oriented, and does not stop copying characters when a 0 value
  1642.       is encountered.
  1643.  
  1644.       The substr function copies a portion of one string to another. Char-
  1645.       acters from position <pos> in string <source> are copied until into
  1646.       string <target> (note that SALT string offsets start at 0, not 1 as
  1647.       in some languages). Characters are copied until a 0 (NULL) value is
  1648.       encountered (normally at the end of every string), or <max> char-
  1649.       acters are copied. A 0 (NULL) is always copied at the end of the
  1650.       target string. The 0 does not count as part of the <max>. Only as
  1651.       many characters as will fit in <target> are copied.
  1652.  
  1653.       o  Return Value
  1654.           Telix v3.00 - SALT Programming      Built-in Functions    31
  1655.  
  1656.  
  1657.  
  1658.  
  1659.       None.
  1660.  
  1661.       o  See Also
  1662.  
  1663.       copystr, subchrs, substr
  1664.  
  1665.       o  Example
  1666.  
  1667.       
  1668.  
  1669.                                                                              _________________________________________________________________
  1670.  
  1671.       copystr
  1672.  
  1673.       o  Summary
  1674.  
  1675.       copystr(str <source>, int <target>, int <pos>, int <count>);
  1676.  
  1677.       o  Description
  1678.  
  1679.       The copystr function copies one string into another at a certain po-
  1680.       sition. Characters in string <source> are copied into string
  1681.       <target> at position <pos> (note that SALT string offsets start at
  1682.       0, not 1 as in some languages). Characters are copied until a 0
  1683.       (NULL) value is encountered (normally at the end of every string),
  1684.       or <max> characters are copied. A 0 (NULL) is always copied at the
  1685.       end of the target string. The 0 does not count as part of the <max>.
  1686.       Only as many characters as will fit in <target> are copied.
  1687.  
  1688.       o  Return Value
  1689.           Telix v3.00 - SALT Programming      Built-in Functions    32
  1690.  
  1691.  
  1692.  
  1693.  
  1694.       None.
  1695.  
  1696.       o  See Also
  1697.  
  1698.       copychrs, substr, subchrs
  1699.  
  1700.       o  Example
  1701.  
  1702.       
  1703.  
  1704.                                                                              _________________________________________________________________
  1705.  
  1706.       cputc
  1707.  
  1708.       o  Summary
  1709.  
  1710.       cputc(int <character>);
  1711.  
  1712.       o  Description
  1713.  
  1714.       The cputc function sends <character> to the communications port.
  1715.       This is the ASCII value of the character to be sent.
  1716.  
  1717.       o  Return Value
  1718.  
  1719.       A non-zero (TRUE) value is returned unless the character can not be
  1720.       sent for some reason, in which case a value of -1 is returned.
  1721.  
  1722.       o  See Also
  1723.  
  1724.       cputs
  1725.  
  1726.       o  Example
  1727.  
  1728.       cputc('A');
  1729.       cputc(27);          // send Escape to the comm port
  1730.       cputc('^M');        // send Ctrl-M (Carriage Return)
  1731.       cputc(inkeyw());
  1732.           Telix v3.00 - SALT Programming      Built-in Functions    33
  1733.  
  1734.  
  1735.  
  1736.  
  1737.                                                                              _________________________________________________________________
  1738.  
  1739.       cputs
  1740.  
  1741.       o  Summary
  1742.  
  1743.       cputs(str <outstr>);
  1744.  
  1745.       o  Description
  1746.  
  1747.       The cputs function sends the passed string out over the modem port.
  1748.       A Carriage Return and Line Feed are NOT added after the string.
  1749.  
  1750.       o  Return Value
  1751.  
  1752.       None.
  1753.  
  1754.       o  See Also
  1755.  
  1756.       cputs_tr
  1757.  
  1758.       o  Example
  1759.  
  1760.       cputs("Good-bye");
  1761.  
  1762.       str password[] = "mypass";
  1763.       cputs(password);
  1764.  
  1765.                                                                              _________________________________________________________________
  1766.  
  1767.       cputs_tr
  1768.  
  1769.       o  Summary
  1770.  
  1771.       cputs_tr(str <outstr>);
  1772.  
  1773.       o  Description
  1774.  
  1775.       The cputs_tr function sends the passed string out over the modem
  1776.       port, but pays attention to two output string translation charac-
  1777.       ters,  ^ and ~, described in the Telix manual. This function is re-
  1778.       ally only useful for sending the modem control strings that the user
  1779.       has defined in the Configuration Menu.
  1780.  
  1781.       o  Return Value
  1782.  
  1783.       None.
  1784.  
  1785.       o  See Also
  1786.  
  1787.       cputs
  1788.           Telix v3.00 - SALT Programming      Built-in Functions    34
  1789.  
  1790.  
  1791.  
  1792.  
  1793.       o  Example
  1794.  
  1795.       cputs_tr(_modem_init);
  1796.       cputs_tr("good-bye~yes^M");
  1797.  
  1798.                                                                              _________________________________________________________________
  1799.  
  1800.       cursor_onoff
  1801.  
  1802.       o  Summary
  1803.  
  1804.       cursor_onoff(int <state>);
  1805.  
  1806.       o  Description
  1807.  
  1808.       The cursor_onoff functions turn the blinking cursor on or off (makes
  1809.       it disappear or reappear), depending on whether state is non-zero
  1810.       (TRUE) or zero (FALSE).
  1811.  
  1812.       o  Return Value
  1813.  
  1814.       None.
  1815.  
  1816.                                                                              _________________________________________________________________
  1817.  
  1818.       curtime
  1819.  
  1820.       o  Summary
  1821.  
  1822.       curtime();
  1823.  
  1824.       o  Description
  1825.  
  1826.       The curtime function returns the current date/time as the number of
  1827.       seconds since Jan 1, 1970. A date/time value in this format is used
  1828.       by many SALT functions.
  1829.  
  1830.       o  Return Value
  1831.  
  1832.       An integer value as described above.
  1833.  
  1834.       o  See Also
  1835.  
  1836.       date, time, tyear, tmonth, tday, thour, tmin, tsec
  1837.  
  1838.       o  Example
  1839.  
  1840.       // Print the current date
  1841.       
  1842.       int t;
  1843.       str s[64];
  1844.       
  1845.       t = curtime();
  1846.       date(t, s);
  1847.       prints(s);
  1848.           Telix v3.00 - SALT Programming      Built-in Functions    35
  1849.  
  1850.  
  1851.  
  1852.  
  1853.                                                                              _________________________________________________________________
  1854.  
  1855.       date
  1856.  
  1857.       o  Summary
  1858.  
  1859.       date(int <timeval>, str <buffer>);
  1860.  
  1861.       o  Description
  1862.  
  1863.       The date function writes out a date in <buffer> in the form
  1864.       mm/dd/yy, dd/mm/yy, or yy/mm/dd (which is based on the system vari-
  1865.       able date_format). <timeval> is the date, represented as the number
  1866.       of seconds since Jan 1, 1970. Time values in this form are returned
  1867.       by the curtime and filetime functions, among others.
  1868.  
  1869.       o  Return Value
  1870.  
  1871.       None.
  1872.  
  1873.       o  See Also
  1874.  
  1875.       time, curtime, filetime
  1876.  
  1877.       o  Example
  1878.  
  1879.       str s[16];
  1880.       printsc("The current date is ");
  1881.       date(curtime(), s);
  1882.       prints(s);
  1883.           Telix v3.00 - SALT Programming      Built-in Functions    36
  1884.  
  1885.  
  1886.  
  1887.  
  1888.                                                                              _________________________________________________________________
  1889.  
  1890.       delay, delay_scr
  1891.  
  1892.       o  Summary
  1893.  
  1894.       delay(int <duration>);
  1895.  
  1896.       delay_scr(int <duration>);
  1897.  
  1898.       o  Description
  1899.  
  1900.       The delay function pauses Telix for a length of time specified in
  1901.       tenths of a second by <duration>. During this pause, everything is
  1902.       shut off except the asynchronous reception of characters from the
  1903.       comm port.
  1904.  
  1905.       The delay_scr function pauses only the execution of the current
  1906.       script file for the indicated duration. During that time, characters
  1907.       coming in from the serial port are printed on the terminal screen,
  1908.       while user keystrokes are also processed.
  1909.  
  1910.       o  Return Value
  1911.  
  1912.       The <duration> argument is returned.
  1913.  
  1914.                                                                              _________________________________________________________________
  1915.  
  1916.       delchrs
  1917.  
  1918.       o  Summary
  1919.  
  1920.       delchrs(str <s>, int <pos>, int <num>);
  1921.  
  1922.       o  Description
  1923.  
  1924.       The delchrs function is used to remove or delete a number of charac-
  1925.       ters in a string at a certain position. <s> is the string to handle.
  1926.       <pos> is the position at which <num> characters will be deleted
  1927.       (note that the first characters in a SALT string has the position
  1928.       0). Remaining characters in the string are be shifted left.
  1929.  
  1930.       o  Return Value
  1931.           Telix v3.00 - SALT Programming      Built-in Functions    37
  1932.  
  1933.  
  1934.  
  1935.  
  1936.       None.
  1937.  
  1938.       o  See Also
  1939.  
  1940.       inschrs
  1941.  
  1942.       o  Example
  1943.  
  1944.       // remove all but the first and last characters in a string
  1945.       
  1946.       str s[] = "0123456789";
  1947.       delchrs(s, 1, strlen(s) - 2);
  1948.  
  1949.                                                                              _________________________________________________________________
  1950.  
  1951.       dial
  1952.  
  1953.       o  Summary
  1954.  
  1955.       dial(str <dialstr>, int <maxtries>, int <no_link>);
  1956.  
  1957.       o  Description
  1958.  
  1959.       The dial function dials the entries specified in <dialstr>. The en-
  1960.       tries should be entered in the same format as used when typing en-
  1961.       tries in the dialing directory. If <dialstr> is empty (""), the di-
  1962.       aling directory is displayed. <maxtries> is the maximum number of
  1963.       dialing attempts. For example, if the string contains one entry, and
  1964.       <maxtries> is equal to 5, Telix will attempt to dial the number 5
  1965.       times. If five entries are indicated, and <maxtries> is equal to 5,
  1966.       each number will only be attempted once.  If <maxtries> is 0, dial-
  1967.       ing will continue until a connection is established. If an entry is
  1968.       connected to, and has a linked script file attached, that script
  1969.       will be run, unless <no_link> is non-zero (TRUE).
  1970.  
  1971.       o  Return Value
  1972.  
  1973.       If there was a connection, the dial function returns the entry num-
  1974.       ber of the entry which was connected to (or 1 if a manual number was
  1975.       dialed). If there was no connection established, 0 is returned. If
  1976.       the <dialstr> has a bad format, -1 is returned.
  1977.       Also, when a connection is successfully established, the entry num-
  1978.       ber of the entry connected to is placed in the system variable
  1979.       _entry_enum, while the name of the entry connected to is placed in
  1980.       the system variable _entry_name.
  1981.  
  1982.       o  See Also
  1983.  
  1984.       redial
  1985.       _entry_enum, _entry_name
  1986.           Telix v3.00 - SALT Programming      Built-in Functions    38
  1987.  
  1988.  
  1989.  
  1990.  
  1991.       o  Example
  1992.  
  1993.       int stat;
  1994.       dial("10 15", 0);
  1995.       dial("m967-1111", 5);
  1996.       stat = dial(number_list, 0);
  1997.  
  1998.                                                                              _________________________________________________________________
  1999.  
  2000.       dos
  2001.  
  2002.       o  Summary
  2003.  
  2004.       dos(str <command>, int <mode>);
  2005.  
  2006.       o  Description
  2007.  
  2008.       The dos function calls the DOS command interpreter (usually COM-
  2009.       MAND.COM, and gives it the passed command string. If the <command>
  2010.       string is empty (""), Telix will drop into a DOS shell, as if the
  2011.       Alt-J command had been executed. Make sure that if you specify a
  2012.       command or program that expects user input you are on hand to give
  2013.       it. The <mode> argument specifies several options, as follows:
  2014.  
  2015.            0    Original screen is restored when command is completed.
  2016.            1    When command is completed, the user is prompted to press a
  2017.                 key and screen is restored as soon as it is pressed.
  2018.            2    Original screen is not restored when command is completed
  2019.            
  2020.  
  2021.       This function is very similar to the run function. It should be used
  2022.       when an internal DOS command is needed or a DOS shell is needed,
  2023.       otherwise run is preferable as it uses less memory and executes
  2024.       faster.
  2025.  
  2026.       o  Return Value
  2027.  
  2028.       The dos function returns a -1 if the command processor can not be
  2029.       found or there is not enough memory to load it, otherwise a 0 is re-
  2030.       turned.
  2031.  
  2032.       o  See Also
  2033.  
  2034.       run, dosfunction
  2035.  
  2036.       o  Example
  2037.  
  2038.       dos("copy a:*.* c:", 1);
  2039.           Telix v3.00 - SALT Programming      Built-in Functions    39
  2040.  
  2041.  
  2042.  
  2043.  
  2044.                                                                              _________________________________________________________________
  2045.  
  2046.       dosfunction
  2047.  
  2048.       o  Summary
  2049.  
  2050.       dosfunction();
  2051.  
  2052.       o  Description
  2053.  
  2054.       The dosfunction function calls up the 'DOS Functions' menu, as if
  2055.       the user had pressed Alt-F while in terminal mode.
  2056.  
  2057.       o  Return Value
  2058.  
  2059.       None.
  2060.  
  2061.       o  See Also
  2062.  
  2063.       dos, run
  2064.  
  2065.                                                                              _________________________________________________________________
  2066.  
  2067.       exittelix
  2068.  
  2069.       o  Summary
  2070.  
  2071.       exittelix(int <returncode>, int <hangup>);
  2072.  
  2073.       o  Description
  2074.  
  2075.       The exittelix function closes any currently open log file, and exits
  2076.       Telix to DOS, as if the user had pressed Alt-X while in terminal
  2077.       mode. The <returncode> argument is the value that should be returned
  2078.       to DOS. This value can be read by whatever called Telix (e.g., a
  2079.       batch file using the errorlevel command). The <hangup> option af-
  2080.       fects what happens if Telix is online. If it is set to non-zero
  2081.       (TRUE), Telix will hang-up before returning to DOS, otherwise the
  2082.       connection will not be disturbed.
  2083.  
  2084.       o  Return Value
  2085.  
  2086.       Since this functions causes Telix to terminate, there is never any
  2087.       return from it.
  2088.  
  2089.       o  Example
  2090.  
  2091.       exittelix(0, 1);
  2092.       exittelix(100, 0);
  2093.           Telix v3.00 - SALT Programming      Built-in Functions    40
  2094.  
  2095.  
  2096.  
  2097.  
  2098.                                                                              _________________________________________________________________
  2099.  
  2100.       fclearerr
  2101.  
  2102.       o  Summary
  2103.  
  2104.       fclearerr(int <fh>);
  2105.  
  2106.       o  Description
  2107.  
  2108.       The fclearerr function clears the error flag assigned to the open
  2109.       file represented by file handle <fh>. It also clears the End Of File
  2110.       flag for that file as well.
  2111.  
  2112.       o  Return Value
  2113.  
  2114.       None.
  2115.  
  2116.       o  See Also
  2117.  
  2118.       ferror, feof
  2119.  
  2120.       o  Example
  2121.  
  2122.       int f;
  2123.       f = fopen("test.dat", "r");
  2124.          ...
  2125.       if (ferror(f))
  2126.        fclearerr(f);
  2127.  
  2128.                                                                              _________________________________________________________________
  2129.  
  2130.       fclose
  2131.  
  2132.       o  Summary
  2133.  
  2134.       fclose(int <fh>);
  2135.  
  2136.       o  Description
  2137.  
  2138.       The fclose functions closes the file represented by the file handle
  2139.       <fh>, which must previously been opened for reading or writing with
  2140.       the fopen function. If the file was opened for writing, any data
  2141.       which is still buffered and waiting to be written out to disk is
  2142.       written before the file is closed.
  2143.  
  2144.       o  Return Value
  2145.  
  2146.       A return value of -1 indicates a problem closing the file.
  2147.  
  2148.       o  See Also
  2149.  
  2150.       fopen
  2151.           Telix v3.00 - SALT Programming      Built-in Functions    41
  2152.  
  2153.  
  2154.  
  2155.  
  2156.       o  Example
  2157.  
  2158.       int f;
  2159.       f = fopen("test.dat", "w");
  2160.          ...
  2161.       fclose(f);
  2162.  
  2163.                                                                              _________________________________________________________________
  2164.  
  2165.       feof
  2166.  
  2167.       o  Summary
  2168.  
  2169.       feof(int <fh>);
  2170.  
  2171.       o  Description
  2172.  
  2173.       The feof function determines if the file position for the open file
  2174.       represented by the file handle <fh> is at the end-of-file position.
  2175.  
  2176.       o  Return Value
  2177.  
  2178.       A non-zero (TRUE) value is returned if the file position is at the
  2179.       end of the file.
  2180.  
  2181.       o  See Also
  2182.  
  2183.       ferror
  2184.  
  2185.       o  Example
  2186.  
  2187.       int f, chr;
  2188.       f = fopen("test.dat", "r");
  2189.       while ((chr = fgetc(f)) != -1)    // print contents of file
  2190.        printc(chr);
  2191.       if (feof(f))
  2192.        prints("Reached end of file.");
  2193.       else
  2194.        prints("Error reading file");
  2195.           Telix v3.00 - SALT Programming      Built-in Functions    42
  2196.  
  2197.  
  2198.  
  2199.  
  2200.                                                                              _________________________________________________________________
  2201.  
  2202.       ferror
  2203.  
  2204.       o  Summary
  2205.  
  2206.       ferror(int <fh>);
  2207.  
  2208.       o  Description
  2209.  
  2210.       The ferror function checks the error flag for a file represented by
  2211.       the file handle <fh>. The error flag stays set until it is cleared
  2212.       with fclearerr or the file is closed.
  2213.  
  2214.       o  Return Value
  2215.  
  2216.       A non-zero (TRUE) value is returned if the file's error flag is set.
  2217.  
  2218.       o  See Also
  2219.  
  2220.       fclearerr, feof
  2221.  
  2222.       o  Example
  2223.  
  2224.       int f;
  2225.       f = fopen("test.dat", "r");       // open file only for reading
  2226.       fputs("This should set the error flag!", f);
  2227.       if (ferror(f))
  2228.        prints("Error writing to file!");
  2229.  
  2230.                                                                              _________________________________________________________________
  2231.  
  2232.       fflush
  2233.  
  2234.       o  Summary
  2235.  
  2236.       fflush(int <fh>);
  2237.  
  2238.       o  Description
  2239.  
  2240.       The fflush function flushes the buffer associated with the file rep-
  2241.       resented by file handle <fh>. If the file is opened for writing, any
  2242.       characters in the buffer are written. If the file is opened for
  2243.       reading, the buffer is cleared.
  2244.  
  2245.       o  Return Value
  2246.  
  2247.       A value of -1 is returned if there is a problem flushing the buffer.
  2248.  
  2249.       o  See Also
  2250.  
  2251.       fopen, fclose
  2252.           Telix v3.00 - SALT Programming      Built-in Functions    43
  2253.  
  2254.  
  2255.  
  2256.  
  2257.                                                                              _________________________________________________________________
  2258.  
  2259.       fgetc
  2260.  
  2261.       o  Summary
  2262.  
  2263.       fgetc(int <fh>);
  2264.  
  2265.       o  Description
  2266.  
  2267.       The fgetc function returns the next character from the file rep-
  2268.       resented by the file handle <fh>. The file must have been opened for
  2269.       reading or from reading and writing, using the fopen function.
  2270.  
  2271.       o  Return Value
  2272.  
  2273.       Returns the character read if successful, or -1 if the end of the
  2274.       file has been reached or an error is encountered.
  2275.  
  2276.       o  See Also
  2277.  
  2278.       fopen, fputc
  2279.  
  2280.       o  Example
  2281.  
  2282.       int f;
  2283.       f = fopen("test.dat", "r");
  2284.       while (!feof(f))        // print all the characters in the file
  2285.        printc(fgetc(f));
  2286.           Telix v3.00 - SALT Programming      Built-in Functions    44
  2287.  
  2288.  
  2289.  
  2290.  
  2291.                                                                              _________________________________________________________________
  2292.  
  2293.       fgets
  2294.  
  2295.       o  Summary
  2296.  
  2297.       fgets(str <buffer>, int <n>, int <fh>);
  2298.  
  2299.       o  Description
  2300.  
  2301.       The fgets function reads characters from the open file indicated by
  2302.       the file handle <fh> into the string variable <buffer>. Reading
  2303.       stops when a newline (Line Feed) character is read, and end-of-file
  2304.       is encountered, a read error occurs, or <n> characters have been
  2305.       read. The Line Feed character (and the Carriage Return that usually
  2306.       precedes it on MS-DOS systems) is not kept as part of the string.
  2307.  
  2308.       Important: The SALT implementation of the fgets() function differs
  2309.       from the C language function of the same name. While both implemen-
  2310.       tations read until the Line Feed character, C keeps that character
  2311.       as part of the input string, while SALT doesn't. This change was
  2312.       made because in almost every case, the Line Feed is not needed, and
  2313.       would otherwise have to be manually stripped by the script after ev-
  2314.       ery read.
  2315.  
  2316.       o  Return Value
  2317.  
  2318.       A value of -1 is returned if there is a read error, or if there is
  2319.       an end-of-file before any characters can be read.
  2320.  
  2321.       o  See Also
  2322.  
  2323.       fopen, fputs
  2324.  
  2325.       o  Example
  2326.  
  2327.       int f;
  2328.       str s[100];
  2329.       f = fopen("test.dat", "r");
  2330.       while (!feof(f))         // print out contents of text file
  2331.        {
  2332.         fgets(s, 100, f);
  2333.         printsc(s);
  2334.        }
  2335.           Telix v3.00 - SALT Programming      Built-in Functions    45
  2336.  
  2337.  
  2338.  
  2339.  
  2340.                                                                              _________________________________________________________________
  2341.  
  2342.       fileattr
  2343.  
  2344.       o  Summary
  2345.  
  2346.       fileattr(str <filespec>);
  2347.  
  2348.       o  Description
  2349.  
  2350.       Under the MS-DOS file system, files have a certain attributes which
  2351.       can determine their functions or the way certain things behave. For
  2352.       example if a file has the 'hidden' bit set as part of its attribute
  2353.       byte, when you do a DOS dir command, the file is not shown. Simi-
  2354.       larly, if a file has the read only bit set, you may not overwrite
  2355.       it.
  2356.  
  2357.       The fileattr function returns an integer value representing the at-
  2358.       tributes of a specified file. <filespec> is the name of the file and
  2359.       may include a drive and directory portion, as well as the DOS wild-
  2360.       card characters * and ?.
  2361.  
  2362.       The value returned is a total of the following attributes.
  2363.  
  2364.            1    Read only file.
  2365.  
  2366.            2    Hidden file. The file is not listed when the DOS dir com-
  2367.                 mand is executed.
  2368.  
  2369.            4    System file. The file is not listed when the DOS dir com-
  2370.                 mand is executed.
  2371.  
  2372.            8    Volume label. This is the volume name of the disk.
  2373.  
  2374.            16   Subdirectory. This is a subdirectory name.
  2375.  
  2376.            32   Archive bit. This is set by DOS whenever a file has been
  2377.                 written to and is then used by some backup software to
  2378.                 check if a file has been modified since last backed-up.
  2379.  
  2380.       Each of these values is a certain bit in a byte. To test for the ex-
  2381.       istence of an attribute, the bitwise AND operator should be used.
  2382.       For example, the following fragment would check if the read only bit
  2383.       in an attribute is set:
  2384.  
  2385.            if (attrib & 1)
  2386.             ...
  2387.  
  2388.       If <filespec> is blank (""), then the attributes of the last file
  2389.       found with the filefind function is returned. Note that calling
  2390.       filesize or filetime in the meantime with a non-blank filename would
  2391.       instead make this call return the attributes of files found with
  2392.       those functions, as they use the same buffer.
  2393.  
  2394.       o  Return Value
  2395.  
  2396.       An integer value representing the combined attributes of the in-
  2397.           Telix v3.00 - SALT Programming      Built-in Functions    46
  2398.  
  2399.  
  2400.  
  2401.  
  2402.       dicated file is returned, or a value of -1 is returned if the in-
  2403.       dicated file could not be found.
  2404.  
  2405.       o  See Also
  2406.  
  2407.       filefind, filesize, filetime
  2408.  
  2409.       o  Example
  2410.  
  2411.       int attr;
  2412.       str filename[64];
  2413.       gets(filename, 64);
  2414.       attr = fileattr(filename);
  2415.       if (attr & 6)      // system _and_ hidden added together
  2416.        prints("This file is marked as hidden and system");
  2417.           Telix v3.00 - SALT Programming      Built-in Functions    47
  2418.  
  2419.  
  2420.  
  2421.  
  2422.                                                                              _________________________________________________________________
  2423.  
  2424.       filefind
  2425.  
  2426.       o  Summary
  2427.  
  2428.       filefind(str <filespec>, int <attrib>, str <buffer>);
  2429.  
  2430.       o  Description
  2431.  
  2432.       The filefind function is used to search for the existence of one or
  2433.       more files or disk directories. Filefind puts in <buffer> the name
  2434.       of the first file matching <filespec>, which may include a drive and
  2435.       path as well as a filename, and may use the DOS wildcard characters
  2436.       * and ? (e.g., "*.*", "C:\TELIX\TELIX.EXE", "SCRIPTS\TEST??.*").
  2437.       <attrib> is the attribute (also see fileattr) which files must
  2438.       match. The attribute is obtained by adding certain values as fol-
  2439.       lows:
  2440.  
  2441.            0    Normal files and read only files
  2442.            2    Hidden files
  2443.            4    System files
  2444.            8    Disk volume label
  2445.            16   Subdirectory
  2446.  
  2447.       If the attribute is 0, only normal (and read-only) files are found.
  2448.       If the volume label is selected, only volume labels will be re-
  2449.       turned. Any other selected attribute or combination (addition) of
  2450.       attributes results in those files and all normal files being
  2451.       matched.
  2452.  
  2453.       When a matching file, directory, or volume name is found, it is put
  2454.       in <buffer> (note that the drive and path portion of filespec are
  2455.       not copied), and a non-zero (TRUE) value is returned. The size,
  2456.       date/time, and attributes of the matched file can be seen with the
  2457.       filesize, filetime, and fileattr functions, respectively.  If no
  2458.       files matching the file specification are found, a zero (FALSE)
  2459.       value is returned.
  2460.  
  2461.       If <filespec> is blank (""), then filefind searches for the next
  2462.       matching file. Note that this will not work after an intervening
  2463.       call to filesize, filetime, or fileattr with a non-blank filename,
  2464.       as the same buffer is used for searches and to keep data.
  2465.  
  2466.       o  Return Value
  2467.  
  2468.       A non-zero (TRUE) value is returned if a file matching the speci-
  2469.       fication was found, otherwise a value of zero (FALSE) is returned.
  2470.  
  2471.       o  See Also
  2472.  
  2473.       filesize, filetime, fileattr
  2474.           Telix v3.00 - SALT Programming      Built-in Functions    48
  2475.  
  2476.  
  2477.  
  2478.  
  2479.       o  Example
  2480.  
  2481.       // show all normal files in the current directory
  2482.       str buf[16], fspec[16] = "*.*";
  2483.       while (filefind(fspec, 0, buf) != 0)
  2484.        {
  2485.         prints(buf);    // show file found
  2486.         fspec = "";     // so we can continue searching for files
  2487.        }
  2488.  
  2489.                                                                              _________________________________________________________________
  2490.  
  2491.       filesize
  2492.  
  2493.       o  Summary
  2494.  
  2495.       filesize(str <filespec>);
  2496.  
  2497.       o  Description
  2498.  
  2499.       The filesize function returns the size in bytes of the specified
  2500.       file. <filespec> is the name of the file and may include a drive and
  2501.       directory portion, as well as the DOS wildcard characters * and ?.
  2502.  
  2503.       If <filespec> is blank (""), then the size of the last file found
  2504.       with the filefind function is returned. Note that calling filetime
  2505.       or fileattr in the meantime with a non-blank filename would instead
  2506.       make this call return the size of files found with those functions,
  2507.       as they use the same buffer.
  2508.  
  2509.       o  Return Value
  2510.  
  2511.       An integer value representing the size of the indicated file is re-
  2512.       turned, or a value of -1 is returned if the indicated file could not
  2513.       be found.
  2514.  
  2515.       o  See Also
  2516.  
  2517.       filefind, filetime, fileattr
  2518.  
  2519.       o  Example
  2520.  
  2521.       str filespec[24] = "*.*", buf[12];
  2522.       int size;
  2523.       siz = filesize("TELIX.EXE");   // get size of file TELIX.EXE
  2524.  
  2525.       // Add up size of all files int he current directory
  2526.       siz = 0;
  2527.       while (filefind(filespec, 0, buf) != 0)   // until no more files
  2528.        {
  2529.         siz = siz + filesize("");   // get size of last filefound file
  2530.         filespec = "";              // make sure filespec is "" on sub-
  2531.                                     // sequent calls to filefind to
  2532.                                     // continue searching for files
  2533.        }
  2534.           Telix v3.00 - SALT Programming      Built-in Functions    49
  2535.  
  2536.  
  2537.  
  2538.  
  2539.                                                                              _________________________________________________________________
  2540.  
  2541.       filetime
  2542.  
  2543.       o  Summary
  2544.  
  2545.       filetime(str <filespec>);
  2546.  
  2547.       o  Description
  2548.  
  2549.       The filetime function returns the date/time of the specified file.
  2550.       <filespec> is the name of the file and may include a drive and di-
  2551.       rectory portion, as well as the DOS wildcard characters * and ?.
  2552.  
  2553.       The values returned represents the file's modification date as the
  2554.       number of seconds since Jan 1, 1970. A date/time in this form can be
  2555.       used by the date, time, tyear, tmonth, tday, thour, tmin, tsec, and
  2556.       other functions.
  2557.  
  2558.       If <filespec> is blank (""), then the date/time of the last file
  2559.       found with the filefind function is returned. Note that calling
  2560.       filesize or fileattr in the meantime with a non-blank filename would
  2561.       instead make this call return the time/date of files found with
  2562.       those functions, as they use the same buffer.
  2563.  
  2564.       o  Return Value
  2565.  
  2566.       An integer value representing the date/time of the indicated file is
  2567.       returned, or a value of -1 is returned if the indicated file could
  2568.       not be found.
  2569.  
  2570.       o  See Also
  2571.  
  2572.       filefind, filesize, fileattr
  2573.  
  2574.       o  Example
  2575.  
  2576.       int time;
  2577.       str s[16];
  2578.       
  2579.       time = filetime("TELIX.EXE");
  2580.       if (time == -1)
  2581.        prints("'TELIX.EXE" could not be found!");
  2582.       else
  2583.        {
  2584.         printsc("TELIX.EXE was created at ");
  2585.         time(time, s);
  2586.         printsc(s);
  2587.         printsc(" on ");
  2588.         date(time, s);
  2589.         printsc(s);
  2590.        }
  2591.       
  2592.       // this example assumes both files exist
  2593.       if (filetime("FILE1") < filetime("FILE2"))
  2594.        prints("FILE1 is older than FILE2");
  2595.           Telix v3.00 - SALT Programming      Built-in Functions    50
  2596.  
  2597.  
  2598.  
  2599.  
  2600.       else
  2601.        prints("FILE1 is newer than FILE2");
  2602.  
  2603.                                                                              _________________________________________________________________
  2604.  
  2605.       flushbuf
  2606.  
  2607.       o  Summary
  2608.  
  2609.       flushbuf();
  2610.  
  2611.       o  Description
  2612.  
  2613.       The flushbuf function flushes (throws away) any characters that may
  2614.       be waiting in Telix's remote input buffer. One use for this command
  2615.       is to get rid of unwanted line noise.
  2616.  
  2617.       o  Return Value
  2618.  
  2619.       None.
  2620.           Telix v3.00 - SALT Programming      Built-in Functions    51
  2621.  
  2622.  
  2623.  
  2624.  
  2625.                                                                              _________________________________________________________________
  2626.  
  2627.       fnstrip
  2628.  
  2629.       o  Summary
  2630.  
  2631.       fnstrip(str <filename>, int <specifier>, str <target>);
  2632.  
  2633.       o  Description
  2634.  
  2635.       The fnstrip function allows specific parts of a filename to be ex-
  2636.       tracted. In the MS-DOS operating system, a filename can consist of
  2637.       up to four parts, the drive, the path, the name, and the extension
  2638.       (e.g., C:\TELIX\TELIX.FON). fnstrip processes the filename specified
  2639.       in <filename>, and depending on the value of <specifier>, places any
  2640.       combination of these four parts in the <target> string. Legal values
  2641.       for <specifier> and their results are as follows:
  2642.  
  2643.            <specifier>    Filename portion copied
  2644.  
  2645.                 0         Full file name
  2646.                 1         All except the drive
  2647.                 2         Drive, name, and extension
  2648.                 3         Name and extension
  2649.                 4         Drive, path, and name (no extension)
  2650.                 5         Path and name (no extension)
  2651.                 6         Drive and name (no extension)
  2652.                 7         Name only (no extension)
  2653.                 12        Drive and path only
  2654.                 13        Path only
  2655.                 14        Drive only
  2656.  
  2657.       o  Return Value
  2658.  
  2659.       None.
  2660.  
  2661.       o  See Also
  2662.  
  2663.       filefind
  2664.  
  2665.       o  Example
  2666.  
  2667.       str filename[64], shortname[16];
  2668.       gets(filename, 64);                 // ask for a filename
  2669.       fnstrip(filename, 3, shortname);    // keep only name & extension
  2670.           Telix v3.00 - SALT Programming      Built-in Functions    52
  2671.  
  2672.  
  2673.  
  2674.  
  2675.                                                                              _________________________________________________________________
  2676.  
  2677.       fopen
  2678.  
  2679.       o  Summary
  2680.  
  2681.       fopen(str <name>, str <mode>);
  2682.  
  2683.       o  Description
  2684.  
  2685.       The fopen function is used to open a disk file for reading and/or
  2686.       writing. The file to be opened is given by <name>. <mode> is a
  2687.       string indicating for what use the file should be opened. Legal val-
  2688.       ues for mode are:
  2689.  
  2690.            "r"       Opens for reading
  2691.            "w"       Opens for writing (truncates any existing file with
  2692.                      the same name)
  2693.            "a"       Opens for appending (writing at the end of the file).
  2694.                      Creates the file if it doesn't exist.
  2695.            "r+"      Opens for reading and writing. Initial position at
  2696.                      the beginning of the file (the file must already ex-
  2697.                      ist).
  2698.            "w+"      Opens for reading and writing. If the file exists its
  2699.                      contents are destroyed.
  2700.            "a+"      Opens for reading and appending. Creates the file if
  2701.                      it doesn't exist.
  2702.            
  2703.       If a file is opened for both reading and writing (when "r+", "w+",
  2704.       or "a+" are used as the mode), an fseek operation is necessary be-
  2705.       fore switching from one to the other.
  2706.  
  2707.       o  Return Value
  2708.  
  2709.       The fopen function returns a 'handle' which is an integer number by
  2710.       which this file is to be referred to until it is finally closed. A
  2711.       value of 0 is returned if the file can not be opened (because it
  2712.       doesn't exist, because a disk error occurred, or because there are
  2713.       no more file handles available). Only up to 8 files may be opened at
  2714.       a time. It is therefore very important to close open files if they
  2715.       are no longer needed and when a script is done, or else all avail-
  2716.       able file handles will become used up.
  2717.  
  2718.       o  See Also
  2719.  
  2720.       fclose
  2721.  
  2722.       o  Example
  2723.  
  2724.       int f;
  2725.       f = fopen("data.txt", "r");    // open the file for reading
  2726.       if (f == 0)
  2727.        prints("Error opening file!");
  2728.           Telix v3.00 - SALT Programming      Built-in Functions    53
  2729.  
  2730.  
  2731.  
  2732.  
  2733.                                                                              _________________________________________________________________
  2734.  
  2735.       fputc
  2736.  
  2737.       o  Summary
  2738.  
  2739.       fputc(int <c>, int <fh>);
  2740.  
  2741.       o  Description
  2742.  
  2743.       The fputc function writes a character to the file indicated by the
  2744.       file handle <fh>. <c> is the character to write.
  2745.  
  2746.       o  Return Value
  2747.  
  2748.       The character written is returned, unless there is an error, in
  2749.       which case a value of -1 is returned.
  2750.  
  2751.       o  See Also
  2752.  
  2753.       fputs, fgetc
  2754.  
  2755.       o  Example
  2756.  
  2757.       int f, i;
  2758.       str teststr[] = "This is a test string";
  2759.       f = fopen("test.dat", "w");
  2760.       for (i = 0; i < 21; ++i)           // write out string to file
  2761.        fputc(subchr(teststr, i), f);     // character by character
  2762.  
  2763.                                                                              _________________________________________________________________
  2764.  
  2765.       fputs
  2766.  
  2767.       o  Summary
  2768.  
  2769.       fputs(str <s>, int <fh>);
  2770.  
  2771.       o  Description
  2772.  
  2773.       The fputs function writes a string to the file represented by file
  2774.       handle <fh>. The string must be 512 bytes in length or less (all
  2775.       strings end in a zero (0) value, the use of which is usually trans-
  2776.       parent; characters are written until this 0 is encountered. The 0 is
  2777.       not written).
  2778.  
  2779.       o  Return Value
  2780.  
  2781.       A 0 value is returned if the write is successful, a non-zero value
  2782.       if it is not.
  2783.  
  2784.       o  See Also
  2785.  
  2786.       fputc, fgets
  2787.           Telix v3.00 - SALT Programming      Built-in Functions    54
  2788.  
  2789.  
  2790.  
  2791.  
  2792.       o  Example
  2793.  
  2794.       int f, i;
  2795.       f = fopen("test.dat", "w");
  2796.       for (i = 0; i < 100; ++i)      // write out "Hello" and a new-
  2797.        fputs("Hello^M^J", f);        // line one hundred times
  2798.  
  2799.                                                                              _________________________________________________________________
  2800.  
  2801.       fread
  2802.  
  2803.       o  Summary
  2804.  
  2805.       fread(str <buf>, int <count>, int <fh>);
  2806.  
  2807.       o  Description
  2808.  
  2809.       The fread function reads up to <count> bytes from the file repre-
  2810.       sented by file handle <fh>. Characters are written to the <buf>
  2811.       variable, which must be large enough.
  2812.  
  2813.       o  Return Value
  2814.  
  2815.       The number of bytes actually read is returned, which may be less
  2816.       than <count> if an error occurs or and end-of-file is encountered.
  2817.  
  2818.       The ferror and feof functions should be used to distinguish an error
  2819.       from an end-of-file condition.
  2820.  
  2821.       o  See Also
  2822.  
  2823.       fwrite
  2824.  
  2825.       o  Example
  2826.  
  2827.       int f;
  2828.       str buffer[40];
  2829.       f = fopen("test.dat", "r");
  2830.       fseek(f, 1000, 0);       // goto offset 1000 in file
  2831.       fread(buffer, 40, f);    // and read 40 bytes of data
  2832.           Telix v3.00 - SALT Programming      Built-in Functions    55
  2833.  
  2834.  
  2835.  
  2836.  
  2837.                                                                              _________________________________________________________________
  2838.  
  2839.       fseek
  2840.  
  2841.       o  Summary
  2842.  
  2843.       fseek(int <fh>, int <offset>, int <origin>);
  2844.  
  2845.       o  Description
  2846.  
  2847.       The fseek function sets the position of the file pointer in the file
  2848.       represented by the file handle <fh>. The file position is where the
  2849.       next read or write will take place. <offset> is the signed offset
  2850.       from the location specified by <origin>. Legal values for <origin>
  2851.       are:
  2852.  
  2853.            0:   Beginning of file.
  2854.            1:   Current position.
  2855.            2:   End of file.
  2856.  
  2857.       The pointer can be positioned anywhere in the file, and even past
  2858.       the end of the file (which will extend it). It is illegal to try to
  2859.       position the pointer before the beginning of the file however.
  2860.  
  2861.       o  Return Value
  2862.  
  2863.       If successful, fseek returns a 0 value, otherwise a non-zero value
  2864.       is returned.
  2865.  
  2866.       o  See Also
  2867.  
  2868.       ftell
  2869.  
  2870.       o  Example
  2871.  
  2872.       int f;
  2873.       f = fopen("test.dat", "r");
  2874.       fseek(f, 0, 0);       // go to offset 0 in file
  2875.       fseek(f, 1000, 0);    // go to offset 1000 in file
  2876.       fseek(f, -5, 1);      // go back 5 places in file
  2877.       fseek(f, 0, 2);       // go to the end of the file
  2878.           Telix v3.00 - SALT Programming      Built-in Functions    56
  2879.  
  2880.  
  2881.  
  2882.  
  2883.                                                                              _________________________________________________________________
  2884.  
  2885.       ftell
  2886.  
  2887.       o  Summary
  2888.  
  2889.       ftell(int <fh>);
  2890.  
  2891.       o  Description
  2892.  
  2893.       The ftell function returns the current file position in the file
  2894.       represented by file handle <fh>.
  2895.  
  2896.       o  Return Value
  2897.  
  2898.       An integer value as described above. A -1 value is returned if an
  2899.       error occurs.
  2900.  
  2901.       o  See Also
  2902.  
  2903.       fseek
  2904.  
  2905.                                                                              _________________________________________________________________
  2906.  
  2907.       fwrite
  2908.  
  2909.       o  Summary
  2910.  
  2911.       fwrite(str <buf>, int <count>, int <fh>);
  2912.  
  2913.       o  Description
  2914.  
  2915.       The fwrite function writes bytes to the file represented by the file
  2916.       handle <fh>. <count> number of bytes are written from <buf>.
  2917.  
  2918.       o  Return Value
  2919.  
  2920.       The number of bytes actually written are returned, which may be less
  2921.       than <count> if an error occurred.
  2922.  
  2923.       o  See Also
  2924.  
  2925.       fread
  2926.  
  2927.       o  Example
  2928.  
  2929.       int f;
  2930.       str buffer[] = "1234567890123456789012345";
  2931.       f = fopen("test.dat", "w");
  2932.       fwrite(buffer, 25, f);       // write test pattern to file
  2933.           Telix v3.00 - SALT Programming      Built-in Functions    57
  2934.  
  2935.  
  2936.  
  2937.  
  2938.                                                                              _________________________________________________________________
  2939.  
  2940.       get_baud
  2941.  
  2942.       o  Summary
  2943.  
  2944.       get_baud();
  2945.  
  2946.       o  Description
  2947.  
  2948.       The get_baud function returns an integer value which is the current
  2949.       baud rate in use on the current communications port (300 through
  2950.       115200).
  2951.  
  2952.       o  Return Value
  2953.  
  2954.       As described above.
  2955.  
  2956.       o  See Also
  2957.  
  2958.       get_parity, get_datab, get_stopb, get_port
  2959.  
  2960.       o  Example
  2961.  
  2962.       prints("The current baud rate is ");
  2963.       printn(get_baud());
  2964.       prints("");
  2965.  
  2966.                                                                              _________________________________________________________________
  2967.  
  2968.       get_datab
  2969.  
  2970.       o  Summary
  2971.  
  2972.       get_datab();
  2973.  
  2974.       o  Description
  2975.  
  2976.       The get_datab function returns the data bits setting in use on the
  2977.       current communications port (7 or 8).
  2978.  
  2979.       o  Return Value
  2980.  
  2981.       As described above.
  2982.  
  2983.       o  See Also
  2984.  
  2985.       get_baud, get_parity, get_stopb, get_port
  2986.           Telix v3.00 - SALT Programming      Built-in Functions    58
  2987.  
  2988.  
  2989.  
  2990.  
  2991.                                                                              _________________________________________________________________
  2992.  
  2993.       get_parity
  2994.  
  2995.       o  Summary
  2996.  
  2997.       get_parity();
  2998.  
  2999.       o  Description
  3000.  
  3001.       The get_parity function returns an integer value which represents
  3002.       the current parity setting in use on the current comm port.
  3003.  
  3004.       o  Return Value
  3005.  
  3006.       Returned values are as follows:
  3007.  
  3008.                 0    No parity
  3009.                 1    Even parity
  3010.                 2    Odd parity
  3011.  
  3012.       o  See Also
  3013.  
  3014.       get_baud, get_datab, get_stopb, get_port
  3015.  
  3016.                                                                              _________________________________________________________________
  3017.  
  3018.       get_port
  3019.  
  3020.       o  Summary
  3021.  
  3022.       get_port();
  3023.  
  3024.       o  Description
  3025.  
  3026.       The get_port function returns the number (1 through 8) of the cur-
  3027.       rent communications port being used.
  3028.  
  3029.       o  Return Value
  3030.  
  3031.       As described above.
  3032.  
  3033.       o  See Also
  3034.  
  3035.       get_baud, get_datab, get_parity, get_stopb
  3036.  
  3037.       o  Example
  3038.  
  3039.       prints("Currently using COM");
  3040.       printn(get_port());
  3041.       prints("");
  3042.           Telix v3.00 - SALT Programming      Built-in Functions    59
  3043.  
  3044.  
  3045.  
  3046.  
  3047.                                                                              _________________________________________________________________
  3048.  
  3049.       get_stopb
  3050.  
  3051.       o  Summary
  3052.  
  3053.       get_stopb();
  3054.  
  3055.       o  Description
  3056.  
  3057.       The get_stopb function returns the stop bits setting in use on the
  3058.       current com port (1 or 2).
  3059.  
  3060.       o  Return Value
  3061.  
  3062.       As described above.
  3063.  
  3064.       o  See Also
  3065.  
  3066.       get_baud, get_datab, get_parity, get_port
  3067.  
  3068.                                                                              _________________________________________________________________
  3069.  
  3070.       gets
  3071.  
  3072.       o  Summary
  3073.  
  3074.       gets(str <buffer>, int <max>);
  3075.  
  3076.       o  Description
  3077.  
  3078.       The gets function allows the user to enter a complete string, and
  3079.       use the arrow keys to edit it while it is being entered. <buffer> is
  3080.       the string variable where the string should be put, while <max> is
  3081.       the maximum number of characters the user may enter (from 0 to 80).
  3082.       The user may edit the string as it is being entered, with the Left-
  3083.       Arrow, Right-Arrow, Ctrl-Left-Arrow, and Ctrl-Right-Arrow keys as it
  3084.       is being entered, and insert mode may be toggled on/off with the INS
  3085.       key. String entry is over when the user presses Enter (Carriage Re-
  3086.       turn on some computers). The user may press Esc to abort string en-
  3087.       try, in which case the resulting string will have a length of 0.
  3088.  
  3089.       o  Return Value
  3090.  
  3091.       The number of characters entered by the user are returned. If the
  3092.       user pressed Esc to abort string entry, a value of -1 is returned.
  3093.  
  3094.       o  See Also
  3095.  
  3096.       getsxy
  3097.           Telix v3.00 - SALT Programming      Built-in Functions    60
  3098.  
  3099.  
  3100.  
  3101.  
  3102.       o  Example
  3103.  
  3104.       int n;
  3105.       str password[8];
  3106.       printsc("Enter a password? ");
  3107.       n = gets(password, 8);
  3108.  
  3109.                                                                              _________________________________________________________________
  3110.  
  3111.       getsxy
  3112.  
  3113.       o  Summary
  3114.  
  3115.       getsxy(str <targets>, int <max>, int <x>, int <y>, int <color>);
  3116.  
  3117.       o  Description
  3118.  
  3119.       The getsxy function is similar to the gets function, but the x,y lo-
  3120.       cation of string entry may be specified, as well as a color at-
  3121.       tribute. <buffer> is the string variable where the string should be
  3122.       put, while <max> is the maximum number of characters the user may
  3123.       enter (from 0 to 80). The cursor will be moved to <x>,<y>, and text
  3124.       entered will use a color as described by <color>.
  3125.  
  3126.       The user may edit the string as it is being entered, with the Left-
  3127.       Arrow, Right-Arrow, Ctrl-Left-Arrow, and Ctrl-Right-Arrow keys as it
  3128.       is being entered, and insert mode may be toggled on/off with the INS
  3129.       key. String entry is over when the user presses Enter (Carriage Re-
  3130.       turn on some computers). The user may press Esc to abort string en-
  3131.       try, in which case the resulting string will have a length of 0.
  3132.  
  3133.       o  Return Value
  3134.  
  3135.       The number of characters entered by the user are returned. If the
  3136.       user pressed Esc to abort string entry, a value of -1 is returned.
  3137.  
  3138.       o  See Also
  3139.  
  3140.       gets
  3141.  
  3142.       o  Example
  3143.  
  3144.       int n;
  3145.       str filename[64] = "C:\TELIX\TELIX.EXE";
  3146.         // allow use to enter filename in black on white
  3147.         // at current cursor position
  3148.       n = getsxy(filename, 64, getx(), gety(), 112);
  3149.           Telix v3.00 - SALT Programming      Built-in Functions    61
  3150.  
  3151.  
  3152.  
  3153.  
  3154.                                                                              _________________________________________________________________
  3155.  
  3156.       getx, gety
  3157.  
  3158.       o  Summary
  3159.  
  3160.       getx();
  3161.  
  3162.       gety();
  3163.  
  3164.       o  Description
  3165.  
  3166.       The getx function returns the current column (horizontal x axis) po-
  3167.       sition of the cursor on the screen.
  3168.  
  3169.       The gety function returns the current row (vertical y axis) position
  3170.       of the cursor on the screen.
  3171.  
  3172.       o  Return Value
  3173.  
  3174.       Returned values will range from 0 for the leftmost column to 79 for
  3175.       the rightmost column, for the getx function.
  3176.  
  3177.       Returned values range from 0 for the upper edge of the screen to 24
  3178.       for the lower edge, for the gety functions..
  3179.  
  3180.       o  See Also
  3181.  
  3182.       gotoxy
  3183.  
  3184.                                                                              _________________________________________________________________
  3185.  
  3186.       gotoxy
  3187.  
  3188.       o  Summary
  3189.  
  3190.       gotoxy(int <xpos>, int <ypos>);
  3191.  
  3192.       o  Description
  3193.  
  3194.       The gotoxy function positions the cursor at the screen coordinates
  3195.       given by <xpos> and <ypos>. Note that 0,0 is the upper left corner.
  3196.       On a 80x25 text screen, the lower right corner would be 79,24.
  3197.  
  3198.       o  Return Value
  3199.  
  3200.       None.
  3201.  
  3202.       o  See Also
  3203.  
  3204.       getx, gety
  3205.           Telix v3.00 - SALT Programming      Built-in Functions    62
  3206.  
  3207.  
  3208.  
  3209.  
  3210.       o  Example
  3211.  
  3212.       gotoxy(0, 0);      // go to the top left corner
  3213.  
  3214.       gotoxy(79, 24);    // go to the bottom right corner
  3215.  
  3216.                                                                              _________________________________________________________________
  3217.  
  3218.       hangup
  3219.  
  3220.       o  Summary
  3221.  
  3222.       hangup();
  3223.  
  3224.       o  Description
  3225.  
  3226.       The hangup function tries to hang-up the modem, exactly as if the
  3227.       user had pressed Alt-H while in terminal mode. This is accomplished
  3228.       by first dropping (turning off) a signal called the DTR line, and if
  3229.       that is unsuccessful, sending the hang-up string defined in the
  3230.       configuration menu.
  3231.  
  3232.       o  Return Value
  3233.  
  3234.       A non-zero (TRUE) value is returned if the hang-up is  successful,
  3235.       otherwise a zero (FALSE) value is returned.
  3236.  
  3237.                                                                              _________________________________________________________________
  3238.  
  3239.       helpscreen
  3240.  
  3241.       o  Summary
  3242.  
  3243.       helpscreen();
  3244.  
  3245.       o  Description
  3246.  
  3247.       The helpscreen function displays the help/status screen, as if the
  3248.       user had pressed the appropriate key while in terminal mode.
  3249.  
  3250.       o  Return Value
  3251.  
  3252.       None.
  3253.           Telix v3.00 - SALT Programming      Built-in Functions    63
  3254.  
  3255.  
  3256.  
  3257.  
  3258.                                                                              _________________________________________________________________
  3259.  
  3260.       inkey, inkeyw
  3261.  
  3262.       o  Summary
  3263.  
  3264.       inkey();
  3265.       inkeyw();
  3266.  
  3267.       o  Description
  3268.  
  3269.       The inkey function returns a character from the keyboard, but does
  3270.       not wait for a key to be pressed.
  3271.  
  3272.       The inkeyw function returns a character from the keyboard, and waits
  3273.       for a key to be pressed if the keyboard buffer is empty.
  3274.  
  3275.       Note that Telix while executing a script file checks the keyboard
  3276.       between every command to see if the user wants to abort the script.
  3277.       For these commands to work, this keyboard checking must be disabled.
  3278.       This is done by setting the _scr_chk_key system variable to a non-
  3279.       zero (FALSE) value (that variable is further described in the sec-
  3280.       tion on system variables).
  3281.  
  3282.       o  Return Value
  3283.  
  3284.       inkey returns the first character in the keyboard buffer, or a value
  3285.       of 0 if the keyboard buffer is empty.
  3286.  
  3287.       inkeyw waits until a key has been pressed if none is available in
  3288.       the keyboard buffer, and returns that value.
  3289.  
  3290.       Both of these functions also return extended key code values which
  3291.       are not part of the ASCII character set (for example, the code for
  3292.       Alt-D). These values are described in the Appendix.
  3293.  
  3294.       o  Example
  3295.  
  3296.       chr = inkey();
  3297.           Telix v3.00 - SALT Programming      Built-in Functions    64
  3298.  
  3299.  
  3300.  
  3301.  
  3302.                                                                              _________________________________________________________________
  3303.  
  3304.       inschrs
  3305.  
  3306.       o  Summary
  3307.  
  3308.       inschrs(str <source>, str <target>, int <pos>, int <num>);
  3309.  
  3310.       o  Description
  3311.  
  3312.       The inschrs function is used to insert characters from one string
  3313.       into another at a specific position, shifting existing characters to
  3314.       the right. Characters are taken from <source> and placed in
  3315.       <target>, at an offset indicated by <pos>. Note that string offsets
  3316.       are numbered starting at 0, so the first character would have an
  3317.       offset of 0, the second 1, etc. Only <num> characters are inserted,
  3318.       and existing characters are shifted to the right (and are lost if
  3319.       they shift past the space allocated for the string).
  3320.  
  3321.       o  Return Value
  3322.  
  3323.       None.
  3324.  
  3325.       o  See Also
  3326.  
  3327.       copystr, copychrs
  3328.  
  3329.       o  Example
  3330.  
  3331.       str test[24] = "Good-bye";
  3332.       // add "Hello" to the front of the existing string
  3333.       inschrs("Hello ", test, 0, 6);
  3334.           Telix v3.00 - SALT Programming      Built-in Functions    65
  3335.  
  3336.  
  3337.  
  3338.  
  3339.                                                                              _________________________________________________________________
  3340.  
  3341.       isalnum - isupper
  3342.  
  3343.       o  Summary
  3344.  
  3345.       isalnum(int <c>);   Test for alphanumeric ('A'-'Z', 'a'-'z', or '0'-
  3346.                                '9'
  3347.  
  3348.       isalpha(int <c>);   Test for letter ('A'-'Z' or 'a'-'z')
  3349.  
  3350.       isascii(int <c>);   Test for ASCII value (0-255)
  3351.  
  3352.       iscntrl(int <c>);   Test for Control character (0-31 or 127)
  3353.  
  3354.       isdigit(int <c>);   Test for digit ('0'-'9')
  3355.  
  3356.       islower(int <c>);   Test for lower case ('a'-'z')
  3357.  
  3358.       isupperint <c>);    Test for upper case ('A'-'Z')
  3359.  
  3360.       o  Description
  3361.  
  3362.       The functions listed above test an integer value and return a non-
  3363.       zero (TRUE) value if the test condition is satisfied, or a zero
  3364.       (FALSE) if it is not.
  3365.  
  3366.       Except for isascii, these functions give valid results only for in-
  3367.       teger values in the ASCII character set, that is, values for which
  3368.       isascii is true.
  3369.  
  3370.       o  Return Value
  3371.  
  3372.       A non-zero (TRUE) value is returned if the test condition is sat-
  3373.       isfied, a 0 (FALSE) value otherwise.
  3374.           Telix v3.00 - SALT Programming      Built-in Functions    66
  3375.  
  3376.  
  3377.  
  3378.  
  3379.                                                                              _________________________________________________________________
  3380.  
  3381.       is_loaded
  3382.  
  3383.       o  Summary
  3384.  
  3385.       is_loaded(str <filename>);
  3386.  
  3387.       o  Description
  3388.  
  3389.       The is_loaded function is used to determine if a SALT script, in-
  3390.       dicated by <filename> is currently loaded into memory. The script
  3391.       can be in memory if it was explicitly loaded with the load_script
  3392.       function, or is still in memory because it previously was run and
  3393.       did not finish executing. If filename does not include an extension,
  3394.       ".SLC" is automatically added.
  3395.  
  3396.       o  Return Value
  3397.  
  3398.       A non-zero (TRUE) values is returned if the indicated script file is
  3399.       in memory, otherwise a zero (FALSE) value is returned.
  3400.  
  3401.       o  See Also
  3402.  
  3403.       load_scr, unload_scr
  3404.  
  3405.       o  Example
  3406.  
  3407.       if (!is_loaded("TESTSCR"))   // make sure script is in memory
  3408.        load_scr("TESTSCR");
  3409.  
  3410.                                                                              _________________________________________________________________
  3411.  
  3412.       itos
  3413.  
  3414.       o  Summary
  3415.  
  3416.       itos(int <value>, str <s>);
  3417.  
  3418.       o  Description
  3419.  
  3420.       The itos function writes out the digits of the supplied integer
  3421.       value to <s>.
  3422.  
  3423.       o  Return Value
  3424.  
  3425.       None.
  3426.  
  3427.       o  See Also
  3428.  
  3429.       stoi
  3430.           Telix v3.00 - SALT Programming      Built-in Functions    67
  3431.  
  3432.  
  3433.  
  3434.  
  3435.       o  Example
  3436.  
  3437.       int chr;
  3438.       str s[16];
  3439.       chr = keyinw();       // get a user keystroke
  3440.       itos(chr, s);         // and print out ASCII value of character
  3441.       prints(s);
  3442.  
  3443.                                                                              _________________________________________________________________
  3444.  
  3445.       keyget
  3446.  
  3447.       o  Summary
  3448.  
  3449.       keyget(int <key>, int <table>, str <buffer>);
  3450.  
  3451.       o  Description
  3452.  
  3453.       The keyget function is used to look at what text is assigned to a
  3454.       key. <key> is an integer value representing the key (as described in
  3455.       the appendix). Any macro text assigned to this key will be placed in
  3456.       <buffer>. Telix keeps two key macro definition tables in memory at
  3457.       all times, a user key table, and a terminal key table, loaded in
  3458.       whenever the current terminal is changed. If <table> is 0, the key
  3459.       is assumed to be in the user table. If <table> is 1, the key is as-
  3460.       sumed to be in the terminal table.
  3461.  
  3462.       o  Return Value
  3463.  
  3464.       None.
  3465.  
  3466.       o  See Also
  3467.  
  3468.       keyset, keyload, keysave
  3469.  
  3470.       o  Example
  3471.  
  3472.       str s[100];
  3473.       prints("Text currently assigned to the F1 key in user table is:)"
  3474.       keyget(0x3a00, 0, s);
  3475.       prints(s);
  3476.           Telix v3.00 - SALT Programming      Built-in Functions    68
  3477.  
  3478.  
  3479.  
  3480.  
  3481.                                                                              _________________________________________________________________
  3482.  
  3483.       keyload
  3484.  
  3485.       o  Summary
  3486.  
  3487.       keyload(str <fname>, int <table>);
  3488.  
  3489.       o  Description
  3490.  
  3491.       The keyload function is used to load a keyboard macro definition
  3492.       file into Telix. <fname> is the name of the definition file (if no
  3493.       extension is given, .KEY is assumed). Telix always keeps two defini-
  3494.       tion tables in memory, a relatively constant user table, and a ter-
  3495.       minal table which changes with each different terminal and holds the
  3496.       proper key assignments for that terminal. If <table> is 0, then the
  3497.       definitions are loaded into the user table. If <table> is 1, the
  3498.       definitions are loaded into the terminal table.
  3499.  
  3500.       o  Return Value
  3501.  
  3502.       A value of -1 is returned if there are problems loading the key
  3503.       file, otherwise a non-zero (TRUE) value is returned.
  3504.  
  3505.       o  See Also
  3506.  
  3507.       keysave, keyget, keyset
  3508.  
  3509.       o  Example
  3510.  
  3511.       keyload("SPECIAL", 0);
  3512.  
  3513.                                                                              _________________________________________________________________
  3514.  
  3515.       keysave
  3516.  
  3517.       o  Summary
  3518.  
  3519.       keysave(str <fname>, int <table>);
  3520.  
  3521.       o  Description
  3522.  
  3523.       The keysave function is used to save the current macro key text def-
  3524.       initions to a disk file. <fname> is the file to save the definitions
  3525.       to, and if no extension is given, ".KEY" is added. Telix always
  3526.       keeps two key definition tables in memory, a relatively constant
  3527.       user table, and a terminal table which changes with each different
  3528.       terminal and holds the proper key assignments for that terminal. If
  3529.       <table> is 0, then the definitions from the user table are saved. If
  3530.       <table> is 1, the definitions from the terminal table are saved.
  3531.  
  3532.       o  Return Value
  3533.           Telix v3.00 - SALT Programming      Built-in Functions    69
  3534.  
  3535.  
  3536.  
  3537.  
  3538.       A value of -1 is returned if there is a problem writing to the file,
  3539.       otherwise a non-zero (TRUE) value is returned.
  3540.  
  3541.       o  See Also
  3542.  
  3543.       keyload, keyget, keyset
  3544.  
  3545.                                                                              _________________________________________________________________
  3546.  
  3547.       keyset
  3548.  
  3549.       o  Summary
  3550.  
  3551.       keyset(int <key>, int <table>, str <text>);
  3552.  
  3553.       o  Description
  3554.  
  3555.       The keyset function is used to assign text to a key. <key> is an in-
  3556.       teger value representing the key (as described in the appendix).
  3557.       <text> is what to assign to this key. Telix always keeps two key
  3558.       definition tables in memory, a relatively constant user table, and a
  3559.       terminal table which changes with each different terminal and holds
  3560.       the proper key assignments for that terminal. If <table> is 0, the
  3561.       key definition in the user table is affected. If <table> is 1, the
  3562.       key definition in the terminal table is affected.
  3563.  
  3564.       o  Return Value
  3565.  
  3566.       None.
  3567.  
  3568.       o  See Also
  3569.  
  3570.       keyget, keyload, keysave
  3571.  
  3572.       o  Example
  3573.  
  3574.       // Assign a name to the F1 key in the user table
  3575.       // Note that if the terminal table also holds a
  3576.       // definition for that key it will take precedence
  3577.       keyset((0x3a00, 0, "Joe Smith");
  3578.           Telix v3.00 - SALT Programming      Built-in Functions    70
  3579.  
  3580.  
  3581.  
  3582.  
  3583.                                                                              _________________________________________________________________
  3584.  
  3585.       loadfon
  3586.  
  3587.       o  Summary
  3588.  
  3589.       int loadfon(str <filename>);
  3590.  
  3591.       o  Description
  3592.  
  3593.       The loadfon function loads the given dialing directory file. The
  3594.       complete name must be given, including any extension (e.g. .FON) or
  3595.       the disk drive/directory if the file is not in the current di-
  3596.       rectory.
  3597.  
  3598.       o  Return Value
  3599.  
  3600.       A non-zero (TRUE) value is returned if the dialing directory file is
  3601.       successfully loaded. If some sort of error occurs (file does not ex-
  3602.       ist, file reading error, etc.) a zero (FALSE) value is returned.
  3603.  
  3604.                                                                              _________________________________________________________________
  3605.  
  3606.       load_scr
  3607.  
  3608.       o  Summary
  3609.  
  3610.       load_scr(str <filename>);
  3611.  
  3612.       o  Description
  3613.  
  3614.       When a script is run (either by the user manually running it from
  3615.       terminal mode, or from within another script), it is usually loaded
  3616.       from disk. The load_scr function is used to load a script into mem-
  3617.       ory ahead of time, providing a savings in time when the script must
  3618.       be run repeatedly. <filename> is the name of the script file to
  3619.       load, and if no extension is given, ".SLC" is assumed.
  3620.  
  3621.       o  Return Value
  3622.  
  3623.       If there is a problem loading the script file (it is not there or
  3624.       there is not enough memory),a value of -1 is returned. Otherwise a
  3625.       non-zero (TRUE) value is returned.
  3626.  
  3627.       o  See Also
  3628.  
  3629.       unload_scr, is_loaded
  3630.  
  3631.       o  Example
  3632.  
  3633.       int stat;
  3634.       stat = load_scr("TEST");     // load TEST.SLC
  3635.           Telix v3.00 - SALT Programming      Built-in Functions    71
  3636.  
  3637.  
  3638.  
  3639.  
  3640.                                                                              _________________________________________________________________
  3641.  
  3642.       newdir
  3643.  
  3644.       o  Summary
  3645.  
  3646.       newdir(<directory>);
  3647.  
  3648.       o  Description
  3649.  
  3650.       The newdir function is used to changed the current drive and/or di-
  3651.       rectory. The <directory> argument should be the drive and/or direc-
  3652.       tory to change to.
  3653.  
  3654.       o  Return Value
  3655.  
  3656.       A non-zero (TRUE) value is returned if the function is successful,
  3657.       otherwise a zero (FALSE) values is returned (if the drive or direc-
  3658.       tory is illegal or doesn't exist).
  3659.  
  3660.       o  See Also
  3661.  
  3662.       dos, run
  3663.  
  3664.       o  Example
  3665.  
  3666.       newdir("C:\TELIX");
  3667.  
  3668.                                                                              _________________________________________________________________
  3669.  
  3670.       printc
  3671.  
  3672.       o  Summary
  3673.  
  3674.       printc(int <chr>);
  3675.  
  3676.       o  Description
  3677.  
  3678.       The printc function prints the character represented by the ASCII
  3679.       value <chr> to the terminal screen.
  3680.  
  3681.       o  Return Value
  3682.  
  3683.       <chr> is returned.
  3684.  
  3685.       o  See Also
  3686.  
  3687.       prints, printsc, printn
  3688.           Telix v3.00 - SALT Programming      Built-in Functions    72
  3689.  
  3690.  
  3691.  
  3692.  
  3693.       o  Example
  3694.  
  3695.       printc('A');
  3696.  
  3697.       printc(7);            // print ASCII value 7 (BELL sound)
  3698.  
  3699.       printc(keyinw());     // print user keypress
  3700.  
  3701.                                                                              _________________________________________________________________
  3702.  
  3703.       printer
  3704.  
  3705.       o  Summary
  3706.  
  3707.       printer(int <state>);
  3708.  
  3709.       o  Description
  3710.  
  3711.       The printer function is used within a script file to turn the
  3712.       printer on or off, as if the user had pressed the appropriate key in
  3713.       terminal mode. If <state> is a non-zero (TRUE) value, echoing to the
  3714.       printer is turned on, otherwise echoing is turned off
  3715.  
  3716.       o  Return Value
  3717.           Telix v3.00 - SALT Programming      Built-in Functions    73
  3718.  
  3719.  
  3720.  
  3721.  
  3722.       None.
  3723.  
  3724.       o  See Also
  3725.  
  3726.       capture
  3727.  
  3728.       o  Example
  3729.  
  3730.       printer(1);         // turn on printer log
  3731.  
  3732.                                                                              _________________________________________________________________
  3733.  
  3734.       printn
  3735.  
  3736.       o  Summary
  3737.  
  3738.       printn(int <num>);
  3739.  
  3740.       o  Description
  3741.  
  3742.       The printn function prints the passed integer number to the terminal
  3743.       screen. The cursor is NOT advanced to the beginning of the next
  3744.       line.
  3745.  
  3746.       o  Return Value
  3747.  
  3748.       The value of the passed integer is returned.
  3749.  
  3750.       o  See Also
  3751.  
  3752.       prints, printsc, printc
  3753.  
  3754.       o  Example
  3755.  
  3756.       printsc("Current baud rate is ");
  3757.       printn(get_baud);
  3758.           Telix v3.00 - SALT Programming      Built-in Functions    74
  3759.  
  3760.  
  3761.  
  3762.  
  3763.                                                                              _________________________________________________________________
  3764.  
  3765.       prints, printsc
  3766.  
  3767.       o  Summary
  3768.  
  3769.       prints(str <outstr>);
  3770.  
  3771.       printsc(str <outstr>);
  3772.  
  3773.       printsc_trm(str <outstr>);
  3774.  
  3775.       o  Description
  3776.  
  3777.       The prints function prints the passed string at the current cursor
  3778.       position on the screen, followed by a Carriage Return and Line Feed
  3779.       (which places the cursor at the beginning of the next line).
  3780.  
  3781.       The printsc function prints the passed string at the current cursor
  3782.       position on the screen. The cursor is not advanced to the next line,
  3783.       hence the 'c', which stands for continuous.
  3784.  
  3785.       The printsc_trm function is similar to the above, except that out-
  3786.       putted characters pass through the current terminal emulator, so
  3787.       terminal escape sequences may be included in output strings.
  3788.  
  3789.       o  Return Value
  3790.  
  3791.       None.
  3792.  
  3793.       o  See Also
  3794.  
  3795.       printn, printc
  3796.  
  3797.       o  Example
  3798.  
  3799.       prints("Hello");
  3800.  
  3801.       printsc("Hello^M^J");    // same effect as above
  3802.  
  3803.       printsc_trm("^[[H");     // go to top left corner in VT102 emulation
  3804.           Telix v3.00 - SALT Programming      Built-in Functions    75
  3805.  
  3806.  
  3807.  
  3808.  
  3809.                                                                              _________________________________________________________________
  3810.  
  3811.       pstra, pstraxy
  3812.  
  3813.       o  Summary
  3814.  
  3815.       pstra(str <s>, int <color>);
  3816.  
  3817.       pstraxy(str <s>, int <x>, int <y>, int <color>);
  3818.  
  3819.       o  Description
  3820.  
  3821.       The pstra (Print STRing with color Attribute) function is used to
  3822.       print a string to the screen, similar to the prints/printsc func-
  3823.       tions. This function is much faster however, and should be used when
  3824.       speed is important. As well, it allows a color to be specified for
  3825.       the text. <s> will be printed to the screen at the current cursor
  3826.       position using a color as specified by <color>.
  3827.  
  3828.       The pstraxy function is similar to the above, but allows you to
  3829.       specify where to print the string. The string is printed at <x>,<y>,
  3830.       with 0,0 being the upper left corner of the screen.
  3831.  
  3832.       Note that prints goes through a basic TTY type terminal emulator, so
  3833.       strings printed using it may contain the basic cursor control code,
  3834.       while pstra writes directly to the screen, ignoring these sequences.
  3835.  
  3836.       o  Return Value
  3837.  
  3838.       None.
  3839.  
  3840.       o  See Also
  3841.  
  3842.       prints, printsc
  3843.  
  3844.       o  Example
  3845.  
  3846.       pstraxy("Enter name:", 10, 10, 112);   // print in inverse text
  3847.           Telix v3.00 - SALT Programming      Built-in Functions    76
  3848.  
  3849.  
  3850.  
  3851.  
  3852.                                                                              _________________________________________________________________
  3853.  
  3854.       receive
  3855.  
  3856.       o  Summary
  3857.  
  3858.       receive(int <protocol>, str <name>);
  3859.  
  3860.       o  Description
  3861.  
  3862.       The receive function is used to receive (download) one or more files
  3863.       from another system. <protocol> is the letter used to select the ap-
  3864.       propriate protocol from the actual download menu in Telix (e.g., 'X'
  3865.       for Xmodem), as follows:
  3866.  
  3867.                 'A'       ASCII
  3868.                 'K'       Kermit
  3869.                 'M'       Modem7
  3870.                 'S'       SEAlink
  3871.                 'T'       Telink
  3872.                 'X'       Xmodem
  3873.                 '1'       Xmodem-1k
  3874.                 'G'       Xmodem-1k-g
  3875.                 'Y'       Ymodem
  3876.                 'E'       YmodEm-g
  3877.                 'Z'       Zmodem
  3878.  
  3879.       If an external protocol is defined, <protocol> may also be the key
  3880.       used to select it. <name> is the name the file should take. For pro-
  3881.       tocols which pass the name, such as SEAlink, Zmodem, Ymodem (batch),
  3882.       and others, the name field should be an empty string, "". If a down-
  3883.       load directory has been defined in the Configuration Menu, received
  3884.       files will go there, unless the <name> string explicitly includes a
  3885.       path to another drive/directory.
  3886.  
  3887.       o  Return Value
  3888.  
  3889.       A value of -1 is returned if the transfer was aborted, except if the
  3890.       Carrier (connection) was lost, in which case a value of -2 is re-
  3891.       turned.
  3892.  
  3893.       o  See Also
  3894.  
  3895.       send, _down_dir
  3896.  
  3897.       o  Example
  3898.  
  3899.       int result;
  3900.       result = receive('X', "TEST.EXE");
  3901.       if (result < 0)
  3902.        prints("File transfer failed!");
  3903.           Telix v3.00 - SALT Programming      Built-in Functions    77
  3904.  
  3905.  
  3906.  
  3907.  
  3908.                                                                              _________________________________________________________________
  3909.  
  3910.       redial
  3911.  
  3912.       o  Summary
  3913.  
  3914.       redial(str <dialstr>, int <maxtries>, int <no_link>);
  3915.  
  3916.       o  Description
  3917.  
  3918.       The redial function dials the entries specified in <dialstr>. The
  3919.       entries should be entered in the same format as used when typing en-
  3920.       tries in the dialing directory. If <dialstr> is empty (""), the re-
  3921.       dial queue is presented to the user, as if Alt-Q was pressed while
  3922.       in terminal mode. <maxtries> is the maximum number of dialing at-
  3923.       tempts. For example, if the string contains one entry, and
  3924.       <maxtries> is equal to 5, Telix will attempt to dial the number 5
  3925.       times. If five entries are indicated, and <maxtries> is equal to 5,
  3926.       each number will only be attempted once. If <maxtries> is 0, dialing
  3927.       will continue until a connection is established. If an entry is con-
  3928.       nected to, and has a linked script file attached, that script will
  3929.       be run, unless <no_link> is non-zero (TRUE).
  3930.  
  3931.       o  Return Value
  3932.  
  3933.       If there was a connection, the redial function returns the entry
  3934.       number of the of the entry which was connected to (or 1 if a manual
  3935.       number was dialed). If there was no connection established, 0 is re-
  3936.       turned. If the <dialstr> has a bad format, -1 is returned.
  3937.       Also, when a connection is successfully established, the entry num-
  3938.       ber of the entry connected to is placed in the system variable
  3939.       _entry_enum, while the name of the entry connected to is placed in
  3940.       the system variable _entry_name.
  3941.  
  3942.       o  See Also
  3943.  
  3944.       dial
  3945.       _entry_enum, _entry_name
  3946.  
  3947.       o  Example
  3948.  
  3949.       int stat;
  3950.       str number_list[] = "1 4 27";
  3951.       redial("10 15", 0);
  3952.       redial("m967-1111", 5);
  3953.       stat = redial(number_list, 0);
  3954.           Telix v3.00 - SALT Programming      Built-in Functions    78
  3955.  
  3956.  
  3957.  
  3958.  
  3959.                                                                              _________________________________________________________________
  3960.  
  3961.       run
  3962.  
  3963.       o  Summary
  3964.  
  3965.       run(str <filename>, str <comline>, int <mode>);
  3966.  
  3967.       o  Description
  3968.  
  3969.       The run function executes the indicated file. The indicated file
  3970.       must either be in the current directory, be on the DOS PATH, or must
  3971.       include the full path to the file (i.e., specify the drive and/or
  3972.       directory). Make sure that if you run a program that expects user
  3973.       input you are on hand to give it. The <comline> parameter is the
  3974.       command line which should be passed to the called program. The
  3975.       <mode> argument specifies several options, as follows:
  3976.  
  3977.            0    Original screen is restored when program is completed.
  3978.            1    When program is completed, the user is prompted to press a
  3979.                 key and screen is restored as soon as it is pressed.
  3980.            2    Original screen is not restored when program is completed
  3981.  
  3982.       This function is similar to the dos function. Because it uses less
  3983.       memory and loads faster, it is preferable to that function unless a
  3984.       DOS Batch file has to be run, or an internal DOS command must be
  3985.       specified, in which case the dos function has to be used.
  3986.  
  3987.       o  Return Value
  3988.  
  3989.       The run function returns a -1 if the file can not be run (because it
  3990.       can not be found or there is not enough memory). Any other value is
  3991.       the value returned by the called program (usually 0), but a positive
  3992.       value may also result when the called program is aborted.
  3993.  
  3994.       o  See Also
  3995.  
  3996.       dos, dosfunction
  3997.  
  3998.       o  Example
  3999.  
  4000.       run("CS test", 1);
  4001.           Telix v3.00 - SALT Programming      Built-in Functions    79
  4002.  
  4003.  
  4004.  
  4005.  
  4006.                                                                              _________________________________________________________________
  4007.  
  4008.       scroll
  4009.  
  4010.       o  Summary
  4011.  
  4012.       scroll(int <x>, int <y>, int <x2>, int <y2>, int <lines>, int
  4013.       <color>);
  4014.  
  4015.       o  Description
  4016.  
  4017.       The scroll function is used to scroll or clear a region of the
  4018.       screen. The area to handle is defined by <x>,<y> as the upper left
  4019.       corner, and <x2>,<y2> as the lower right corner (the upper left cor-
  4020.       ner of the screen is 0,0). If the <lines> parameter is a positive
  4021.       value, text within the region is scrolled up that many lines. If
  4022.       <lines> is a negative value, text within the region is scrolled down
  4023.       that many lines. If <lines> is equal to 0, the entire region is
  4024.       cleared. Empty lines scrolled into the region will have a color of
  4025.       <color>.
  4026.  
  4027.       o  Return Value
  4028.           Telix v3.00 - SALT Programming      Built-in Functions    80
  4029.  
  4030.  
  4031.  
  4032.  
  4033.       None.
  4034.  
  4035.       o  See Also
  4036.  
  4037.       box
  4038.  
  4039.       o  Example
  4040.  
  4041.       scroll(0, 0, 79, 24, 10, 7);      // scroll screen up 10 lines
  4042.  
  4043.                                                                              _________________________________________________________________
  4044.  
  4045.       send
  4046.  
  4047.       o  Summary
  4048.  
  4049.       send(int <protocol>, str <name>);
  4050.  
  4051.       o  Description
  4052.  
  4053.       The send function is used to send (upload) one or more files to an-
  4054.       other system over the comm port. <protocol> is the letter used to
  4055.       select the appropriate protocol from the actual download menu in
  4056.       Telix (e.g., 'X' for Xmodem) as follows:
  4057.  
  4058.                 'A'       ASCII
  4059.                 'K'       Kermit
  4060.                 'M'       Modem7
  4061.                 'S'       SEAlink
  4062.                 'T'       Telink
  4063.                 'X'       Xmodem
  4064.                 '1'       Xmodem-1k
  4065.                 'G'       Xmodem-1k-g
  4066.                 'Y'       Ymodem
  4067.                 'E'       YmodEm-g
  4068.                 'Z'       Zmodem
  4069.  
  4070.       If an external protocol is defined, <protocol> may also be the key
  4071.       used to select. <name> is the file(s) to send. <name> may include
  4072.       the DOS wildcard characters * and ?, in which case all matching
  4073.       files will be sent (however the protocol used must be capable of
  4074.       sending more than one file at a time, e.g., SEAlink, Zmodem, Ymodem
  4075.       (batch), etc.). If an upload directory has been defined in the Con-
  4076.       figuration Menu, Telix will look there for files specified to be
  4077.       sent, unless the <name> string explicitly includes a path to another
  4078.       drive/directory.
  4079.  
  4080.       o  Return Value
  4081.  
  4082.       A value of -1 is returned if the transfer was aborted, except if the
  4083.       carrier (connection) was lost, in which case a value of -2 is re-
  4084.       turned.
  4085.  
  4086.       o  See Also
  4087.  
  4088.       receive, _up_dir
  4089.           Telix v3.00 - SALT Programming      Built-in Functions    81
  4090.  
  4091.  
  4092.  
  4093.  
  4094.                                                                              _________________________________________________________________
  4095.  
  4096.       send_brk
  4097.  
  4098.       o  Summary
  4099.  
  4100.       send_brk(<duration>);
  4101.  
  4102.       o  Description
  4103.  
  4104.       The send_brk function sends a sustained break signal over the modem
  4105.       port, for a period of time, specified in tenths of a second, by
  4106.       <duration>.
  4107.  
  4108.       o  Return Value
  4109.  
  4110.       None.
  4111.  
  4112.                                                                              _________________________________________________________________
  4113.  
  4114.       set_cparams
  4115.  
  4116.       o  Summary
  4117.  
  4118.       set_cparams(int <baud>, int <parity>, int <data>, int <stop>);
  4119.  
  4120.       o  Description
  4121.  
  4122.       The set_cparams function is used to set the communications param-
  4123.       eters in use on the current communications port. Allowable <baud>
  4124.       values are 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, and
  4125.       115200. <parity> is an integer number which stands for the parity to
  4126.       use. Allowable values are 0, 1, and 2, which stand for None, Even,
  4127.       and Odd parity, respectively. <data> is the data bits setting to
  4128.       use; allowable values are 7 or 8. <stop> is the stop bits setting to
  4129.       use; allowable values are 1 or 2. Note that some combinations of
  4130.       settings are illegal.
  4131.  
  4132.       o  Return Value
  4133.  
  4134.       If all the settings are legal values, a non-zero (TRUE) value is re-
  4135.       turned, otherwise a value of -1 is returned.
  4136.  
  4137.       o  See Also
  4138.  
  4139.       set_port
  4140.  
  4141.       o  Example
  4142.  
  4143.       set_cparams(2400, 0, 8, 1);
  4144.  
  4145.       set_cparams(9600, get_parity(), get_datab(), get_stopb());
  4146.           Telix v3.00 - SALT Programming      Built-in Functions    82
  4147.  
  4148.  
  4149.  
  4150.  
  4151.                                                                              _________________________________________________________________
  4152.  
  4153.       set_defprot
  4154.  
  4155.       o  Summary
  4156.  
  4157.       set_defprot(int <protocol>);
  4158.  
  4159.       o  Description
  4160.  
  4161.       The set_defprot function is used to set the default file transfer
  4162.       protocol presented to the user when a file transfer is requested.
  4163.       <protocol> is the letter used to select the appropriate protocol at
  4164.       the file transfer menu (see the description of the receive function
  4165.       for possible options).
  4166.  
  4167.       o  Return Value
  4168.  
  4169.       None.
  4170.  
  4171.       o  See Also
  4172.  
  4173.       receive, send
  4174.  
  4175.       o  Example
  4176.  
  4177.       set_defprot('Z');      // Select Zmodem as default protocol
  4178.  
  4179.                                                                              _________________________________________________________________
  4180.  
  4181.       setchr
  4182.  
  4183.       o  Summary
  4184.  
  4185.       setchr(str <buf>, int <pos>, int <c>);
  4186.  
  4187.       o  Description
  4188.  
  4189.       The setchr function puts the character <c> at position <pos> in the
  4190.       string indicated by <buf>.
  4191.  
  4192.       o  Return Value
  4193.  
  4194.       The character <c> is returned.
  4195.  
  4196.       o  See Also
  4197.  
  4198.       setchrs, subchr
  4199.  
  4200.       o  Example
  4201.  
  4202.       int i;
  4203.       str s[100];
  4204.       for (i = 0; i < 10; ++i)     // set first 10 characters to 'A'
  4205.        setchr(s, i, 'A');
  4206.           Telix v3.00 - SALT Programming      Built-in Functions    83
  4207.  
  4208.  
  4209.  
  4210.  
  4211.                                                                              _________________________________________________________________
  4212.  
  4213.       setchrs
  4214.  
  4215.       o  Summary
  4216.  
  4217.       setchrs(str <buf>, int <pos>, int <c>, int <count>);
  4218.  
  4219.       o  Description
  4220.  
  4221.       The setchrs function is used to set a range of characters in a
  4222.       string to the same value. <buf> is the string in which characters
  4223.       will be set, starting at an offset indicated by <pos> (note that the
  4224.       first character in a SALT string has an offset of 0, the second, 1,
  4225.       and so on). <count> characters will be set to the value of <c>.
  4226.  
  4227.       o  Return Value
  4228.  
  4229.       None.
  4230.  
  4231.       o  See Also
  4232.  
  4233.       setchr, subchrs
  4234.  
  4235.       o  Example
  4236.  
  4237.       str s[100];
  4238.       // zero out an entire string
  4239.       setchrs(s, 0, 0, strmaxlen(s));
  4240.       // set the first ten characters to 'A'
  4241.       setchrs(s, 0, 'A', 10);
  4242.  
  4243.                                                                              _________________________________________________________________
  4244.  
  4245.       set_port
  4246.  
  4247.       o  Summary
  4248.  
  4249.       set_port(int <port>);
  4250.  
  4251.       o  Description
  4252.  
  4253.       The set_port function is used to select a communications port to
  4254.       use. Allowable values for <port> are 1 through 8.
  4255.  
  4256.       o  Return Value
  4257.  
  4258.       If the new port can be successfully initialized, a non-zero (TRUE)
  4259.       value is returned, otherwise a value of -1 is returned.
  4260.  
  4261.       o  See Also
  4262.  
  4263.       set_cparams
  4264.           Telix v3.00 - SALT Programming      Built-in Functions    84
  4265.  
  4266.  
  4267.  
  4268.  
  4269.                                                                              _________________________________________________________________
  4270.  
  4271.       set_terminal
  4272.  
  4273.       o  Summary
  4274.  
  4275.       set_terminal(str <terminal_name>);
  4276.  
  4277.       o  Description
  4278.  
  4279.       The set_terminal function is used to switch the current terminal be-
  4280.       ing emulated. <terminal_name> is the name of the new terminal to
  4281.       use, as follows:
  4282.  
  4283.            "TTY"
  4284.            "ANSI-BBS"
  4285.            "VT102"
  4286.            "VT52"
  4287.            "AVATAR"
  4288.  
  4289.       o  Return Value
  4290.  
  4291.       A value of -1 is returned if there is a problem switching to the in-
  4292.       dicated terminal emulator, otherwise a non-zero (TRUE) value is re-
  4293.       turned.
  4294.  
  4295.       o  Example
  4296.  
  4297.       set_terminal("VT102");
  4298.           Telix v3.00 - SALT Programming      Built-in Functions    85
  4299.  
  4300.  
  4301.  
  4302.  
  4303.                                                                              _________________________________________________________________
  4304.  
  4305.       show_directory
  4306.  
  4307.       o  Summary
  4308.  
  4309.       show_directory(str <filespec>, int <cecho>, int <carrier>);
  4310.  
  4311.       o  Description
  4312.  
  4313.       The show_directory function displays a files directory listing to
  4314.       the screen and optionally echoes it to the comm port. The <filespec>
  4315.       is the file mask to use (e.g., "*.*"), and may also include a drive
  4316.       and/or directory, just like the DOS 'dir' command. If the <cecho>
  4317.       argument is non-zero (TRUE), the listing is also be echoed to the
  4318.       comm port. If the <carrier> argument is non-zero (TRUE) and the
  4319.       listing is being echoed to the comm port, the carrier signal is mon-
  4320.       itored in case the connection is lost (which aborts the display).
  4321.       The user is prompted to press a key after every screen full of data.
  4322.  
  4323.       o  Return Value
  4324.  
  4325.       None.
  4326.  
  4327.       o  See Also
  4328.  
  4329.       dos, dosfunction
  4330.  
  4331.       o  Example
  4332.  
  4333.       show_directory("*.DOC", 0, 0);
  4334.  
  4335.                                                                              _________________________________________________________________
  4336.  
  4337.       status_wind
  4338.  
  4339.       o  Summary
  4340.  
  4341.       status_wind(str <message>, int <duration>);
  4342.  
  4343.       o  Description
  4344.  
  4345.       The status_wind function is used to display a status message,
  4346.       <message>, in a pop up window. <duration> is the time in tenths of
  4347.       seconds to display the window, after which it is removed, and the
  4348.       previous contents of that screen area are restored.
  4349.  
  4350.       o  Return Value
  4351.           Telix v3.00 - SALT Programming      Built-in Functions    86
  4352.  
  4353.  
  4354.  
  4355.  
  4356.       None.
  4357.  
  4358.       o  See Also
  4359.  
  4360.       box, pstra, pstraxy
  4361.  
  4362.       o  Example
  4363.  
  4364.       status_wind("File not found!", 10);
  4365.  
  4366.                                                                              _________________________________________________________________
  4367.  
  4368.       stoi
  4369.  
  4370.       o  Summary
  4371.  
  4372.       stoi(str <s>);
  4373.  
  4374.       o  Description
  4375.  
  4376.       The stoi function assumes that <s> is a string which contains an in-
  4377.       teger number, written out. It processes the string digit by digit
  4378.       and returns that value. For example, stoi("123") would return the
  4379.       integer value 123. Processing stops at the first non-digit charac-
  4380.       ter. If an empty or invalid string is parsed, a value of 0 is re-
  4381.       turned.
  4382.  
  4383.       o  Return Value
  4384.  
  4385.       An integer value as described above.
  4386.  
  4387.       o  See Also
  4388.  
  4389.       itos
  4390.  
  4391.       o  Example
  4392.  
  4393.       str s[] = "123";
  4394.       if (stoi(s) == 123)
  4395.        prints("This will always be printed!");
  4396.           Telix v3.00 - SALT Programming      Built-in Functions    87
  4397.  
  4398.  
  4399.  
  4400.  
  4401.                                                                              _________________________________________________________________
  4402.  
  4403.       strcat
  4404.  
  4405.       o  Summary
  4406.  
  4407.       strcat(str <string1>, str <string2>);
  4408.  
  4409.       o  Description
  4410.  
  4411.       The strcat function concatenates (adds or appends) one string to the
  4412.       other. <string2> is added to the end of <string1>. If <string1> is
  4413.       not large enough only as many characters as will fit are added.
  4414.  
  4415.       o  Return Value
  4416.  
  4417.       None.
  4418.  
  4419.       o  Example
  4420.  
  4421.       str s[80] = "hello";
  4422.       strcat(s, "good-bye");
  4423.       if (s == "hellogoodbye")
  4424.        prints("This will always be printed");
  4425.           Telix v3.00 - SALT Programming      Built-in Functions    88
  4426.  
  4427.  
  4428.  
  4429.  
  4430.                                                                              _________________________________________________________________
  4431.  
  4432.       strchr
  4433.  
  4434.       o  Summary
  4435.  
  4436.       strchr(str <s>, int <pos>, int <c);
  4437.  
  4438.       o  Description
  4439.  
  4440.       The strchr function is used to search for a character within a
  4441.       string. <s> is the string to search, and <pos> is the starting posi-
  4442.       tion of the search, and <c> is the character (ASCII value) to search
  4443.       for. If the character, its offset is returned, otherwise a value of
  4444.       -1 is returned. Note that the first character in a string has an
  4445.       offset of 0, not 1 as in some languages.
  4446.  
  4447.       o  Return Value
  4448.  
  4449.       An integer value as described above.
  4450.  
  4451.       o  Example
  4452.  
  4453.       // Count how many times a certain char occurs in a string
  4454.       
  4455.       int i, count = 0;
  4456.       str s[] = "abcabcabcabcabc";
  4457.       
  4458.       i = 0;
  4459.       do
  4460.        {
  4461.         i = strchr(s, i, 'a');
  4462.         if (i != -1)
  4463.          count = count + 1;
  4464.        }
  4465.       while (i != -1);
  4466.           Telix v3.00 - SALT Programming      Built-in Functions    89
  4467.  
  4468.  
  4469.  
  4470.  
  4471.                                                                              _________________________________________________________________
  4472.  
  4473.       strcmpi
  4474.  
  4475.       o  Summary
  4476.  
  4477.       strcmpi(str <string1>, str <string2>);
  4478.  
  4479.       o  Description
  4480.  
  4481.       The strcmpi function is used to compare two strings (in a similar
  4482.       manner to the ==, >, and < operators, but ignoring the case of the
  4483.       strings). The strings are compared character by character until a
  4484.       difference is found or the end of either string is found, and an in-
  4485.       teger value is returned as follows:
  4486.  
  4487.            0         <string1> is equal to <string2>
  4488.  
  4489.            < 0       <string1> is less than <string2>
  4490.  
  4491.            > 0       <string1> is greater than <string2>
  4492.  
  4493.       o  Return Value
  4494.  
  4495.       An integer value as described above.
  4496.  
  4497.       o  Example
  4498.  
  4499.       if (strcmpi("HeLLo", "hEllO");
  4500.        prints("This will always be printed");
  4501.  
  4502.                                                                              _________________________________________________________________
  4503.  
  4504.       strlen
  4505.  
  4506.       o  Summary
  4507.  
  4508.       strlen(str <s>);
  4509.  
  4510.       o  Description
  4511.  
  4512.       The strlen function returns the number of characters in the string
  4513.       <s>. Since strings are terminated with a 0 (NULL) character, this
  4514.       function really counts the number of characters before a 0 is en-
  4515.       countered.
  4516.  
  4517.       o  Return Value
  4518.  
  4519.       An integer value representing the length of a string.
  4520.  
  4521.       o  See Also
  4522.  
  4523.       strmaxlen
  4524.           Telix v3.00 - SALT Programming      Built-in Functions    90
  4525.  
  4526.  
  4527.  
  4528.  
  4529.       o  Example
  4530.  
  4531.       str teststr[] = "This is a test string";
  4532.       printsc("The length of 'teststr' is ");
  4533.       printn(strlen(teststr));
  4534.  
  4535.                                                                              _________________________________________________________________
  4536.  
  4537.       strlower
  4538.  
  4539.       o  Summary
  4540.  
  4541.       strlower(str <s>);
  4542.  
  4543.       o  Description
  4544.  
  4545.       The strlower function processes the string <s> and changes each up-
  4546.       per case character to lower case. Other characters are left un-
  4547.       changed.
  4548.  
  4549.       o  Return Value
  4550.  
  4551.       None.
  4552.  
  4553.       o  See Also
  4554.  
  4555.       strupper
  4556.  
  4557.                                                                              _________________________________________________________________
  4558.  
  4559.       strmaxlen
  4560.  
  4561.       o  Summary
  4562.  
  4563.       strmaxlen(str <s>);
  4564.  
  4565.       o  Description
  4566.  
  4567.       The strmaxlen function returns the maximum number of characters that
  4568.       string <s> can hold. This is the same value as used when the string
  4569.       is defined elsewhere in the program (e.g. if the string was defined
  4570.       as 'str hello[16];', a value of 16 would be returned). All strings
  4571.       are really one character larger than defined, as the last character
  4572.       is always a terminating 0 (NULL). However, since this value can not
  4573.       be changed, it is not counted as part of the length of a string.
  4574.  
  4575.       o  Return Value
  4576.  
  4577.       An integer value as described above.
  4578.  
  4579.       o  See Also
  4580.  
  4581.       strlen
  4582.           Telix v3.00 - SALT Programming      Built-in Functions    91
  4583.  
  4584.  
  4585.  
  4586.  
  4587.                                                                              _________________________________________________________________
  4588.  
  4589.       strpos, strposi
  4590.  
  4591.       o  Summary
  4592.  
  4593.       strpos;(str <string1>, str <substr>, int <start>);
  4594.  
  4595.       strposi;(str <string1>, str <substr>, int <start>);
  4596.  
  4597.       o  Description
  4598.  
  4599.       The strpos function is used to search for one string within another.
  4600.       <string1> is scanned for <substr>, starting at the offset (position)
  4601.       indicated by <start>. If the sub-string is found, its offset is re-
  4602.       turned, otherwise a value of -1 is returned. Note that the first
  4603.       character has an offset of 0, not 1 as in some languages.
  4604.  
  4605.       strposi is a case insensitive version of the above.
  4606.  
  4607.       o  Return Value
  4608.  
  4609.       An integer value as described above.
  4610.  
  4611.       o  Example
  4612.  
  4613.       str teststr[] = "cat dog cat dog";
  4614.       int i = 0, num = 0;
  4615.       
  4616.       while (1)           // loop as long as needed
  4617.        {
  4618.         i = strpos(teststr, "cat", i);
  4619.         if (i == -1)
  4620.          break;
  4621.         i = i + 1;        // make sure we don't find the same one
  4622.         num = num + 1;    // increment count
  4623.        }
  4624.       
  4625.       prints("'cat' was found ");
  4626.       printn(num);
  4627.       prints(" times.");
  4628.  
  4629.                                                                              _________________________________________________________________
  4630.  
  4631.       strupper
  4632.  
  4633.       o  Summary
  4634.  
  4635.       strupper(str <s>);
  4636.  
  4637.       o  Description
  4638.  
  4639.       The strupper function processes the string <s> and changes each
  4640.       lower case character to upper case. Other characters are left un-
  4641.       changed.
  4642.  
  4643.       o  Return Value
  4644.           Telix v3.00 - SALT Programming      Built-in Functions    92
  4645.  
  4646.  
  4647.  
  4648.  
  4649.       None.
  4650.  
  4651.       o  See Also
  4652.  
  4653.       strlower
  4654.  
  4655.                                                                              _________________________________________________________________
  4656.  
  4657.       subchr
  4658.  
  4659.       o  Summary
  4660.  
  4661.       subchr(str <s>, int <pos>);
  4662.  
  4663.       o  Description
  4664.  
  4665.       The subchr function returns the character found at position <pos> in
  4666.       string <s>. Note that an integer (representing the ASCII value of
  4667.       the character) is returned, not a string. <pos> may be anywhere
  4668.       within the string length as defined. Note that positions start from
  4669.       0. The 1st character in a string is at position 0, the 40th at posi-
  4670.       tion 39, etc. A string defined with a length of 10 would have valid
  4671.       positions of 0 to 9, with position 10 always returning the 0 value
  4672.       that terminates all strings.
  4673.  
  4674.       o  Return Value
  4675.  
  4676.       An integer value as described above.
  4677.  
  4678.       o  See Also
  4679.  
  4680.       setchr, subchrs
  4681.  
  4682.       o  Example
  4683.  
  4684.       // This will print out the contents of a test string, extracting
  4685.       // each character individually, and stopping when a 0 is reached
  4686.       // which marks the end of all proper strings
  4687.       
  4688.       int i;
  4689.       str s[] = "This is a test string";
  4690.       for (i = 0; subchr(s, i) != 0; ++i)
  4691.        printc(subchr(s, i));
  4692.           Telix v3.00 - SALT Programming      Built-in Functions    93
  4693.  
  4694.  
  4695.  
  4696.  
  4697.                                                                              _________________________________________________________________
  4698.  
  4699.       subchrs
  4700.  
  4701.       o  Summary
  4702.  
  4703.       subchrs(str <source>, int <pos>, int <count>, str <target>);
  4704.  
  4705.       o  Description
  4706.  
  4707.       The subchrs function copies a number of characters from one string
  4708.       into another, Characters from position <pos> in <source> are copied
  4709.       until into string <target> (note that SALT string offsets start at
  4710.       0, not 1 as in some languages). <count> characters are copied. Only
  4711.       as many characters as will fit in <target> are copied.
  4712.  
  4713.       This function is very similar to substr, except that it is not
  4714.       string oriented, and does not stop copying characters when a 0 value
  4715.       is encountered.
  4716.  
  4717.       o  Return Value
  4718.  
  4719.       None.
  4720.  
  4721.       o  See Also
  4722.  
  4723.       substr, subchr, copystr, copychrs
  4724.  
  4725.                                                                              _________________________________________________________________
  4726.  
  4727.       substr
  4728.  
  4729.       o  Summary
  4730.  
  4731.       substr(str <source>, int <pos>, int <max>, str <target>);
  4732.  
  4733.       o  Description
  4734.  
  4735.       The substr function copies a portion of one string to another. Char-
  4736.       acters from position <pos> in string <source> are copied until into
  4737.       string <target> (note that SALT string offsets start at 0, not 1 as
  4738.       in some languages). Characters are copied until a 0 (NULL) value is
  4739.       encountered (normally at the end of every string), or <max> char-
  4740.       acters are copied. A 0 (NULL) is always copied at the end of the
  4741.       target string. The 0 does not count as part of the <max>. Only as
  4742.       many characters as will fit in <target> are copied.
  4743.  
  4744.       o  Return Value
  4745.  
  4746.       None.
  4747.  
  4748.       o  See Also
  4749.  
  4750.       subchrs, copystr, copychrs
  4751.           Telix v3.00 - SALT Programming      Built-in Functions    94
  4752.  
  4753.  
  4754.  
  4755.  
  4756.       o  Example
  4757.  
  4758.       str s[] = "horse cat dog", s2;
  4759.       substr(s, 6, 3, s2);
  4760.       if (s2 == "cat")
  4761.        prints("This will always be printed");
  4762.           Telix v3.00 - SALT Programming      Built-in Functions    95
  4763.  
  4764.  
  4765.  
  4766.  
  4767.                                                                              _________________________________________________________________
  4768.  
  4769.       tday - tyear
  4770.  
  4771.       o  Summary
  4772.  
  4773.       tday(int <timeval>);
  4774.  
  4775.       thour(int <timeval>);
  4776.  
  4777.       tmin(int <timeval>);
  4778.  
  4779.       tmonth(int <timeval>);
  4780.  
  4781.       tsec(int <timeval>);
  4782.  
  4783.       tyear(int <timeval>);
  4784.  
  4785.       o  Description
  4786.  
  4787.       These functions all extract time information from <timeval>, which
  4788.       is a date and/or time of day. If <timeval> represents a date, it is
  4789.       the number of seconds from Jan 1, 1970 to that date. If <timeval>
  4790.       represents a time of day, it is the number of seconds from midnight
  4791.       to that time. If it is both, the two above values are simply added
  4792.       together.  Among others, the curtime and filetime functions return
  4793.       time/date information in this format.
  4794.  
  4795.       tday returns an integer value from 1 to 31 representing the day por-
  4796.       tion of the date stored in <timeval>.
  4797.  
  4798.       thour returns an integer value from 0 to 23 representing the hour
  4799.       portion of the time stored in <timeval>.
  4800.  
  4801.       tmin returns an integer value from 0 to 59 representing the minutes
  4802.       portion of the time stored in <timeval>.
  4803.  
  4804.       tmonth returns an integer value from 1 to 12 representing the month
  4805.       portion of the date stored in <timeval>.
  4806.  
  4807.       tsec returns an integer value from 1 to 59 representing the seconds
  4808.       portion of the time stored in <timeval>.
  4809.  
  4810.       tyear returns an integer value from 1970 to 2019 representing the
  4811.       year portion of the date stored in <timeval>.
  4812.  
  4813.       o  Return Value
  4814.  
  4815.       An integer value as described above.
  4816.  
  4817.       o  See Also
  4818.  
  4819.       curtime, filetime
  4820.  
  4821.       o  Example
  4822.  
  4823.       int t;
  4824.           Telix v3.00 - SALT Programming      Built-in Functions    96
  4825.  
  4826.  
  4827.  
  4828.  
  4829.       t = curtime();
  4830.       printsc("This is month number ");
  4831.       printn(tmonth(t));
  4832.       printsc(" in the year ");
  4833.       printn(tyear(t));
  4834.       prints(".");
  4835.  
  4836.                                                                              _________________________________________________________________
  4837.  
  4838.       terminal
  4839.  
  4840.       o  Summary
  4841.  
  4842.       terminal();
  4843.  
  4844.       o  Description
  4845.  
  4846.       The terminal function when called allows Telix to process characters
  4847.       coming in from the serial port and print them on the terminal
  4848.       screen, and process user keystrokes. If a function has nothing to do
  4849.       (for example while using the track function), it can call terminal
  4850.       to make sure characters and user keystrokes are processed. Note that
  4851.       if a user script wants to process every incoming character (e.g.,
  4852.       with the cgetc function, the terminal function should never be
  4853.       called).
  4854.  
  4855.       o  Return Value
  4856.  
  4857.       None.
  4858.  
  4859.       o  See Also
  4860.  
  4861.       track
  4862.           Telix v3.00 - SALT Programming      Built-in Functions    97
  4863.  
  4864.  
  4865.  
  4866.  
  4867.       o  Example
  4868.  
  4869.       // This will wait forever for either of two strings
  4870.       // to come in from the comm port, and then stop.
  4871.  
  4872.       int t1, t2, stat;
  4873.  
  4874.       t1 = track("hello", 0);
  4875.       t2 = track("good-bye", 0);
  4876.  
  4877.       while (1)           // loop forever
  4878.        {
  4879.         terminal();       // The call to terminal() lets any characters
  4880.                           // that come in be looked at by Telix's
  4881.                           // internal routines for a match with.
  4882.                           // Incoming chars are also printed on the
  4883.                           // terminal screen and user keystrokes are
  4884.                           // handled
  4885.  
  4886.         stat = track_hit(0);
  4887.         if (stat == t1 || stat == t2)   // exit if one of the strings
  4888.          break;                         // came in
  4889.        }
  4890.       
  4891.       track_free(t1);     // stop Telix for looking for more matches
  4892.       track_free(t2);
  4893.  
  4894.                                                                              _________________________________________________________________
  4895.  
  4896.       time
  4897.  
  4898.       o  Summary
  4899.  
  4900.       time(int <timeval>, str <buffer>);
  4901.  
  4902.       o  Description
  4903.  
  4904.       The time function writes out a time in <buffer> in the form
  4905.       hh:mm:ss, with hh being the hour in either 12 or 24 hour format
  4906.       based on the date_format). <timeval> is the time, represented as the
  4907.       number of seconds since midnight. Time values in this form are re-
  4908.       turned by the curtime and filetime functions, among others.
  4909.  
  4910.       o  Return Value
  4911.  
  4912.       None.
  4913.  
  4914.       o  See Also
  4915.  
  4916.       date, curtime, filetime
  4917.           Telix v3.00 - SALT Programming      Built-in Functions    98
  4918.  
  4919.  
  4920.  
  4921.  
  4922.       o  Example
  4923.  
  4924.       str s[16];
  4925.       printsc("The current time is ");
  4926.       time(curtime(), s);
  4927.       prints(s);
  4928.           Telix v3.00 - SALT Programming      Built-in Functions    99
  4929.  
  4930.  
  4931.  
  4932.  
  4933.                                                                              _________________________________________________________________
  4934.  
  4935.       time_up - timer_total
  4936.  
  4937.       o  Summary
  4938.  
  4939.       time_up(int <thandle>);
  4940.  
  4941.       timer_free(int <thandle>);
  4942.  
  4943.       timer_restart(int <thandle>, int <time>);
  4944.  
  4945.       timer_start(int <time>);
  4946.  
  4947.       timer_total(int <thandle>);
  4948.  
  4949.       o  Description
  4950.  
  4951.       The timer functions are used to set and keep track of a timer vari-
  4952.       able.
  4953.  
  4954.       The timer_start function is used to start a timer. This timer can
  4955.       later be used to check if a certain period of time has elapsed from
  4956.       when the timer was started. This function returns an integer value
  4957.       called a timer handle, that is used to refer to this timer in the
  4958.       future. The <time> parameter is the time from the present (in tenths
  4959.       of a second) after which the timer should be considered elapsed (for
  4960.       use with the time_up function). If the time_up function will not be
  4961.       used, then this parameter can be anything.
  4962.  
  4963.       The time_up function returns a non-zero (TRUE) value if the timer
  4964.       represented by timer handle <thandle> has elapsed, otherwise a 0
  4965.       (FALSE) value is returned. The period of time after which a timer
  4966.       will elapse is specified in the timer_start function.
  4967.  
  4968.       The timer_total function returns the total time (in tenths of a sec-
  4969.       ond) since the timer represented by timer handle <thandle> was
  4970.       started or restarted.
  4971.  
  4972.       The timer_restart function performs the same things as timer_start,
  4973.       except that it restarts an existing timer, represented by timer han-
  4974.       dle <thandle>.
  4975.  
  4976.       The timer_free function frees a timer variable when it is no longer
  4977.       needed. <thandle> is the timer handle of the timer to free, and
  4978.       should originally have been returned by the timer_start function.
  4979.       After a timer has been freed it should no longer be referred to.
  4980.  
  4981.       o  Return Value
  4982.  
  4983.       timer_start returns an integer number representing a 'handle' by
  4984.       which a timer will be referred to.
  4985.  
  4986.       time_up returns a non-zero (TRUE) or 0 (FALSE) value depending on
  4987.       whether a timer has elapsed or not.
  4988.  
  4989.       timer_total returns an integer value representing the elapsed time
  4990.           Telix v3.00 - SALT Programming      Built-in Functions    100
  4991.  
  4992.  
  4993.  
  4994.  
  4995.       since a timer was started.
  4996.  
  4997.       timer_restart does not return any significant value.
  4998.  
  4999.       timer_free does not return any significant value.
  5000.  
  5001.       o  See Also
  5002.  
  5003.       delay
  5004.  
  5005.       o  Example
  5006.  
  5007.       int t;
  5008.  
  5009.       t = timer_start(100);    // delay for 10 seconds
  5010.       while (!time_up(t))
  5011.        ;
  5012.       timer_free(t);
  5013.  
  5014.       // start a timer and loop forever, printing the elapsed time
  5015.       // in tenths of seconds
  5016.       t = timer_start(0);
  5017.       while (1)
  5018.        {
  5019.         printn(timer_total(t));
  5020.         prints("");
  5021.        }
  5022.  
  5023.                                                                              _________________________________________________________________
  5024.  
  5025.       tolower
  5026.  
  5027.       o  Summary
  5028.  
  5029.       tolower(int <chr>);
  5030.  
  5031.       o  Description
  5032.  
  5033.       If the character <chr> is an uppercase character, the tolower func-
  5034.       tion returns the lowercase equivalent. Otherwise <chr> is returned
  5035.       unchanged. Note that <chr> is an ASCII value, not a string.
  5036.  
  5037.       o  Return Value
  5038.  
  5039.       An integer value as described above.
  5040.  
  5041.       o  See Also
  5042.  
  5043.       toupper
  5044.           Telix v3.00 - SALT Programming      Built-in Functions    101
  5045.  
  5046.  
  5047.  
  5048.  
  5049.                                                                              _________________________________________________________________
  5050.  
  5051.       tone
  5052.  
  5053.       o  Summary
  5054.  
  5055.       tone(int <frequency>, int <length>);
  5056.  
  5057.       o  Description
  5058.  
  5059.       The tone function makes Telix emit a sound of <frequency> for a pe-
  5060.       riod of time represented by length (in hundredths of a second).
  5061.  
  5062.       o  Return Value
  5063.  
  5064.       None.
  5065.  
  5066.       o  See Also
  5067.  
  5068.       alarm
  5069.  
  5070.       o  Example
  5071.  
  5072.       tone(659, 14);
  5073.  
  5074.                                                                              _________________________________________________________________
  5075.  
  5076.       toupper
  5077.  
  5078.       o  Summary
  5079.  
  5080.       tolower(int <chr>);
  5081.  
  5082.       o  Description
  5083.  
  5084.       If the character <chr> is an lowercase character, the toupper func-
  5085.       tion returns the uppercase equivalent. Otherwise <chr> is returned
  5086.       unchanged. Note that <chr> is an ASCII value, not a string.
  5087.  
  5088.       o  Return Value
  5089.  
  5090.       An integer value as described above.
  5091.  
  5092.       o  See Also
  5093.  
  5094.       tolower
  5095.           Telix v3.00 - SALT Programming      Built-in Functions    102
  5096.  
  5097.  
  5098.  
  5099.  
  5100.                                                                              _________________________________________________________________
  5101.  
  5102.       track - track_hit
  5103.  
  5104.       o  Summary
  5105.  
  5106.       track(str <trackstr>, int <mode>);
  5107.  
  5108.       track_hit(int <handle>);
  5109.  
  5110.       track_addchr(int <chr>);
  5111.  
  5112.       track_free(int <handle>);
  5113.  
  5114.       o  Description
  5115.  
  5116.       The track and related functions are used to keep track of and wait
  5117.       for certain strings to come in over the comm port, similar in nature
  5118.       to the waitfor function. However the latter function can only wait
  5119.       for one specific string, while with the track functions can handle
  5120.       more strings at the same time (currently up to 16), and they may ar-
  5121.       rive in any order (or not arrive at all).
  5122.  
  5123.       The track function tells Telix to keep track of (watch for) the
  5124.       string indicated by <trackstr> to come in over the comm port. If
  5125.       <mode> is 0, case is significant, if <mode> is 1, case is not sig-
  5126.       nificant. The former is faster and should be used when the many
  5127.       strings are being watched for. Track returns an integer value called
  5128.       a 'track handle' which is later used with the track_hit function to
  5129.       check if this string came in.
  5130.  
  5131.       When track is called, Telix doesn't loop endlessly waiting for the
  5132.       string to come in, but instead returns back to the script. As char-
  5133.       acters come in, Telix checks to see if any of the strings to be
  5134.       tracked have been matched, and marks those that have. A script can
  5135.       at any time call the track_hit function to see if the string repre-
  5136.       sented by <handle> was received. If track_hit returns a non-zero
  5137.       (TRUE) value, then that string was received, otherwise it wasn't. If
  5138.       <handle> is 0, then track_hit will return the lowest numbered handle
  5139.       of any strings that came in, or 0 if none did. The marker on a han-
  5140.       dle is cleared once track_hit has indicated that the appropriate
  5141.       string was received.
  5142.  
  5143.       While a script is executing, Telix is not in terminal mode, and
  5144.       therefore does not have access to incoming characters, to scan for
  5145.       matching strings. Therefore, the terminal function must periodically
  5146.       be called to allow Telix to get a look at incoming characters. This
  5147.       function is described in the appropriate place in this manual. Al-
  5148.       ternately, if a script must process these characters itself (with a
  5149.       function like cgetc), and therefore can not call the terminal func-
  5150.       tion, they must still be passed by the track routines for string
  5151.       matching to work. The track_addchr function is used for this. When
  5152.       it is called, Telix treats the character represented by <chr> as if
  5153.       it had been received from the terminal handler, and uses it to scan
  5154.       for matching strings.
  5155.  
  5156.       The track_free function is used to tell Telix to stop tracking a
  5157.           Telix v3.00 - SALT Programming      Built-in Functions    103
  5158.  
  5159.  
  5160.  
  5161.  
  5162.       certain string. <handle> is a track handle returned by a previous
  5163.       call to the track function. It is very important that when a certain
  5164.       string no longer needs to be tracked, track_free is called, as
  5165.       tracking a large number of strings can slow down Telix execution. If
  5166.       <handle> is 0, Telix will stop tracking all string.
  5167.  
  5168.       o  Return Value
  5169.  
  5170.       All functions return integer values as described above.
  5171.  
  5172.       o  See Also
  5173.  
  5174.       waitfor
  5175.  
  5176.       o  Example
  5177.  
  5178.       // Log-on to a BBS, answering two prompts in any order.
  5179.       // This will wait forever, so for actual use would have
  5180.       // to be changed a bit. See sample scripts for examples.
  5181.  
  5182.       int stat, t1, t2;
  5183.       t1 = track("Name? ", 0);
  5184.       t2 = track("Password? ", 0);
  5185.  
  5186.       while (1)         // loop as long as needed
  5187.        {
  5188.         terminal();     // call terminal function to allow Telix
  5189.                         // to look at incoming characters for
  5190.                         // matches and let Telix process user
  5191.                         // keystrokes
  5192.  
  5193.         stat = track_hit(0);       // see if any matches
  5194.  
  5195.         if (stat == t1)            // name prompt
  5196.           cputs("Joe Smith^M");    // send name and continue looping
  5197.  
  5198.         if (stat == t2)            // password prompt
  5199.          {
  5200.           cputs("mypass^M");       // send password
  5201.           break;                   //   and get out of loop
  5202.          }
  5203.        }
  5204.       
  5205.       track_free(t1);              // free track handles
  5206.       track_free(t2);
  5207.           Telix v3.00 - SALT Programming      Built-in Functions    104
  5208.  
  5209.  
  5210.  
  5211.  
  5212.                                                                              _________________________________________________________________
  5213.  
  5214.       transtab
  5215.  
  5216.       o  Summary
  5217.  
  5218.       transtab(str <filename>, int <table>);
  5219.  
  5220.       o  Description
  5221.  
  5222.       The transtab function is used to load or clear the incoming or out-
  5223.       going character translation table. <table> stands for the translate
  5224.       table to manipulate, with 0 being the incoming, and 1 being the out-
  5225.       going.
  5226.  
  5227.       If <filename> is empty (""), Telix will prompt for the name of a
  5228.       translate table to load into memory.
  5229.  
  5230.       If <filename> is a valid name for a Telix translate table (saved
  5231.       from the translate table menu in Telix), it is loaded into memory.
  5232.  
  5233.       If <filename> is "*CLEAR*", the current translate table in memory is
  5234.       cleared, and Telix will no longer translate incoming characters.
  5235.  
  5236.       o  Return Value
  5237.  
  5238.       A value of -1 is returned if there is a problem loading the indi-
  5239.       cated translate table, otherwise a non-zero (TRUE) value is re-
  5240.       turned.
  5241.  
  5242.       o  Example
  5243.  
  5244.       transtab("TELIX.XLT");
  5245.  
  5246.                                                                              _________________________________________________________________
  5247.  
  5248.       update_term
  5249.  
  5250.       o  Summary
  5251.  
  5252.       update_term();
  5253.  
  5254.       o  Description
  5255.  
  5256.       The update_term function is called to make sure Telix updates cer-
  5257.       tain things relating to the video and terminal page. Fro example,
  5258.       changes made to the _back_color and _fore_color system variables
  5259.       will not take effect until this function is called. As well Telix
  5260.       may sometimes take up to 15 seconds to update the status bar (and in
  5261.       some cases while scripts are running, won't update it at all). Call-
  5262.       ing this function ensures that the status bar is updated.
  5263.  
  5264.       o  Return Value
  5265.           Telix v3.00 - SALT Programming      Built-in Functions    105
  5266.  
  5267.  
  5268.  
  5269.  
  5270.       None.
  5271.  
  5272.       o  Example
  5273.  
  5274.       int temp;               // reverse current terminal colors
  5275.       temp = back_color;
  5276.       back_color = fore_color;
  5277.       fore_color = temp;
  5278.       update_term();
  5279.  
  5280.                                                                              _________________________________________________________________
  5281.  
  5282.       vgetchr
  5283.  
  5284.       o  Summary
  5285.  
  5286.       vgetchr();
  5287.  
  5288.       o  Description
  5289.  
  5290.       The vgetchr function is used to read the character (including color
  5291.       information) at the current cursor position on the video screen. The
  5292.       return value contains the character in the first (low) byte,a nd the
  5293.       color of the character in the higher (second) byte. Each component
  5294.       may be extracted using the & and >> operators as shown in the exam-
  5295.       ple below. Basically, if 'c' is the returned character/color value,
  5296.       the character alone may be obtained by using the expression
  5297.  
  5298.            (c & 255)
  5299.  
  5300.       while the color value is
  5301.  
  5302.            (c >> 8)
  5303.  
  5304.       o  Return Value
  5305.  
  5306.       An integer value as described above.
  5307.  
  5308.       o  See Also
  5309.  
  5310.       vputchr
  5311.  
  5312.       o  Example
  5313.  
  5314.       int chr;
  5315.       chr = vgetchr();      // Get char/color at current cursor position
  5316.  
  5317.       printsc("The character was ");
  5318.       printc(chr & 255);    // get character by masking out color byte
  5319.       printsc(" with a color value of ");
  5320.       printn(chr >> 8);     // shift color byte
  5321.           Telix v3.00 - SALT Programming      Built-in Functions    106
  5322.  
  5323.  
  5324.  
  5325.  
  5326.                                                                              _________________________________________________________________
  5327.  
  5328.       vputchr
  5329.  
  5330.       o  Summary
  5331.  
  5332.       vputchr(int <chr>);
  5333.  
  5334.       o  Description
  5335.  
  5336.       The vputchr function is used to place a character on the screen at
  5337.       the current cursor position, specifying color information at the
  5338.       same time. <chr> is the character to place on the screen. the low
  5339.       byte contains the ASCII value fo the character, while the second
  5340.       byte contains the color value. In general, a if 'c' is the charac-
  5341.       ter, and 'color' is the color to use, the proper value is obtained
  5342.       with the expression
  5343.  
  5344.            (c + color << 8)
  5345.  
  5346.       o  Return Value
  5347.  
  5348.       None.
  5349.  
  5350.       o  See Also
  5351.  
  5352.       vgetchr
  5353.  
  5354.       o  Example
  5355.  
  5356.       // Place an inverse 'X' in the left top corner of the screen
  5357.  
  5358.       gotoxy(0, 0);
  5359.       vputchr('X' + 112 << 8);
  5360.  
  5361.                                                                              _________________________________________________________________
  5362.  
  5363.       vrstrarea
  5364.  
  5365.       o  Summary
  5366.  
  5367.       vrstrarea(int <vhandle>);
  5368.  
  5369.       o  Description
  5370.  
  5371.       The vrstrarea function is used to restore a previously saved portion
  5372.       of the screen. <vhandle> is the video information handle returned by
  5373.       a previous call to vsavearea, which saved the screen area.
  5374.  
  5375.       Note, it is very important that <vhandle> is a valid handle, re-
  5376.       turned by a previous call to vsavearea, or unpredictable results
  5377.       will happen.
  5378.  
  5379.       o  Return Value
  5380.           Telix v3.00 - SALT Programming      Built-in Functions    107
  5381.  
  5382.  
  5383.  
  5384.  
  5385.       None.
  5386.  
  5387.       o  See Also
  5388.  
  5389.       vsavearea
  5390.  
  5391.                                                                              _________________________________________________________________
  5392.  
  5393.       vsavearea
  5394.  
  5395.       o  Summary
  5396.  
  5397.       vsavearea(int <x1>, int <y1>, int <x2>, int <y2>);
  5398.  
  5399.       o  Description
  5400.  
  5401.       The vsavearea function is used to save a rectangular portion of the
  5402.       screen (to be later restored). <x1>,<y1> is the upper left corner of
  5403.       the area to save, while <x2>,<y2> is the lower right corner. Charac-
  5404.       ters (and their colors) currently on the screen in this rectangle
  5405.       are saved in a buffer, and a 'handle' is returned, which must be
  5406.       stored and used int he subsequent call to vrstrarea to restore the
  5407.       saved area. If not enough memory exists to save the video bytes, a
  5408.       value of -1 is returned instead.
  5409.  
  5410.       Note that Telix has only a limited amount of space for allocating to
  5411.       video buffers of this type. At one time, only about as much area as
  5412.       would amount to a full screen should be saved with calls to this
  5413.       function.
  5414.  
  5415.       It is also very important that for every call to this function,
  5416.       there is a subsequent call to vrstrarea. If this is not done, memory
  5417.       will become used up until no more is left.
  5418.  
  5419.       o  Return Value
  5420.  
  5421.       An integer value representing a 'handle' to the saved area.
  5422.  
  5423.       o  See Also
  5424.  
  5425.       vrstrarea
  5426.  
  5427.       o  Example
  5428.  
  5429.       int vhandle;
  5430.  
  5431.       vhandle = vsavearea(0, 0, 79, 24);  // save the current screen
  5432.       myfunc();                           // call a function
  5433.                                           // which modifies screen
  5434.       vrstrarea(vhandle);                 // restore previous screen
  5435.           Telix v3.00 - SALT Programming      Built-in Functions    108
  5436.  
  5437.  
  5438.  
  5439.  
  5440.                                                                              _________________________________________________________________
  5441.  
  5442.       waitfor
  5443.  
  5444.       o  Summary
  5445.  
  5446.       waitfor(str <waitstr>, int <timeout>);
  5447.  
  5448.       o  Description
  5449.  
  5450.       The waitfor function is used to wait for the given string to come in
  5451.       over the serial port. Timeout is the maximum amount of time, in sec-
  5452.       onds, to wait for the string. Case is not significant, and the
  5453.       string must be no longer than 40 characters.
  5454.  
  5455.       o  Return Value
  5456.  
  5457.       A non-zero (TRUE) value is returned if the string is received from
  5458.       the serial port in the given time, otherwise a zero (FALSE) value is
  5459.       returned.
  5460.  
  5461.       o  See Also
  5462.  
  5463.       track
  5464.  
  5465.       o  Example
  5466.  
  5467.       if (waitfor("name?", 1800))
  5468.        prints("The string 'name?' came in from the comm port.");
  5469.       else
  5470.        {
  5471.         prints("The string 'name?' did not come in from the");
  5472.         prints("comm port in 3 minutes!");
  5473.        }
  5474.           Telix v3.00 - SALT Programming      Built-in Functions    109
  5475.  
  5476.  
  5477.  
  5478.  
  5479.                                                                              _________________________________________________________________
  5480.  
  5481.       usagelog
  5482.  
  5483.       o  Summary
  5484.  
  5485.       usagelog(str <filename>);
  5486.  
  5487.       o  Description
  5488.  
  5489.       The usagelog function is used to manipulate the Telix usage log fa-
  5490.       cility.
  5491.  
  5492.       If <filename> is an empty string (""), Telix will ask for the file-
  5493.       name to open the usage log to, as if the user had pressed Alt-U in
  5494.       terminal mode.
  5495.  
  5496.       If <filename> contains a valid filename, the usage log is opened to
  5497.       that file. The standard usage log is usually called "TELIX.USE".
  5498.  
  5499.       If <filename> is "*CLOSE*", and the usage log is currently open, it
  5500.       is closed.
  5501.  
  5502.       o  Return Value
  5503.  
  5504.       A value of -1 is returned if there is a problem performing the indi-
  5505.       cated operation, otherwise a non-zero (TRUE) value is returned.
  5506.  
  5507.       o  See Also
  5508.  
  5509.       ustamp
  5510.  
  5511.       o  Example
  5512.  
  5513.       usagelog("TELIX.USE");
  5514.  
  5515.                                                                              _________________________________________________________________
  5516.  
  5517.       usage_stat
  5518.  
  5519.       o  Summary
  5520.  
  5521.       usage_stat();
  5522.  
  5523.       o  Description
  5524.  
  5525.       The usage_stat function returns an integer value representing the
  5526.       current status of the Usage Log. If the Usage Log is currently open,
  5527.       a non-zero (TRUE) value is returned, otherwise a value of zero
  5528.       (FALSE) is returned.
  5529.  
  5530.       o  Return Value
  5531.           Telix v3.00 - SALT Programming      Built-in Functions    110
  5532.  
  5533.  
  5534.  
  5535.  
  5536.       An integer values as described above.
  5537.  
  5538.       o  See Also
  5539.  
  5540.       capture_stat
  5541.  
  5542.                                                                              _________________________________________________________________
  5543.  
  5544.       ustamp
  5545.  
  5546.       o  Summary
  5547.  
  5548.       ustamp(str <text>, int <new_entry>, int <add_nl>);
  5549.  
  5550.       o  Description
  5551.  
  5552.       The ustamp function is used to place (stamp) text into the Telix us-
  5553.       age log. If the usage log is currently not open, this function call
  5554.       is simply ignored. <text> is the entry that should be placed into
  5555.       the usage log. If <new_entry> contains a non-zero (TRUE) value, the
  5556.       current date/time is placed ahead of the text, otherwise it is as-
  5557.       sumed that this is a continuation of a previous entry and no
  5558.       date/time is added. If <add_nl> (add new line) is a non-zero (TRUE)
  5559.       value, a Carriage Return and Line Feed character are added after the
  5560.       entry. This is usually the case unless something else must be added
  5561.       on the same line.
  5562.  
  5563.       o  Return Value
  5564.  
  5565.       A value of -1 is returned if there is a problem writing to the usage
  5566.       log, otherwise a non-zero (TRUE) value is returned.
  5567.  
  5568.       o  See Also
  5569.  
  5570.       usagelog
  5571.  
  5572.       o  Example
  5573.  
  5574.       ustamp("Calling user subroutine... ", 1, 0);
  5575.       if (user_sub == -1)
  5576.        ustamp("Failed!, 0, 1);
  5577.       else
  5578.        ustamp("Successful", 0, 1);
  5579.           Telix v3.00 - SALT Programming        System Variables    111
  5580.  
  5581.  
  5582.  
  5583.  
  5584.       5.  SYSTEM VARIABLES
  5585.  
  5586.       Telix has quite a large number predefined built-in variables. They
  5587.       are called System Variables and are used to store many preferences.
  5588.       There are both string and numeric system variables, and they are ac-
  5589.       cessed just as you would access any other variable. To help distin-
  5590.       guish them apart from normal variables, and to avoid confusion, they
  5591.       all start with an underscore (_) character.
  5592.  
  5593.       The following pages contain descriptions of all the system vari-
  5594.       ables. For each variable, a summary and a description are given. An
  5595.       example of actual usage of the variable will often be given.
  5596.  
  5597.       The variables are listed in alphabetical order. So that you may find
  5598.       related variables (and built-in functions), most variable descrip-
  5599.       tions have a 'See also' section, which lists related variables and
  5600.       functions.
  5601.           Telix v3.00 - SALT Programming        System Variables    112
  5602.  
  5603.  
  5604.  
  5605.  
  5606.                                                                              _________________________________________________________________
  5607.  
  5608.       _add_lf
  5609.  
  5610.       o  Summary
  5611.  
  5612.       int _add_lf;
  5613.  
  5614.       o  Description
  5615.  
  5616.       If the _add_lf system variable is set to non-zero (TRUE), a Line
  5617.       Feed character is automatically added after every Carriage Return
  5618.       character that comes in.
  5619.  
  5620.                                                                              _________________________________________________________________
  5621.  
  5622.       _alarm_on
  5623.  
  5624.       o  Summary
  5625.  
  5626.       int _alarm_on;
  5627.  
  5628.       o  Description
  5629.  
  5630.       If the _alarm_on system variable is set to non-zero (TRUE), alarms
  5631.       are enabled in Telix. Note that if the _sound_off system variable is
  5632.       set to zero (FALSE), alarms will not be heard no matter what the
  5633.       state of this variable.
  5634.  
  5635.       o  See Also
  5636.  
  5637.       _sound_on
  5638.  
  5639.                                                                              _________________________________________________________________
  5640.  
  5641.       _answerback_str
  5642.  
  5643.       o  Summary
  5644.  
  5645.       str _answerback_str[19];
  5646.  
  5647.       o  Description
  5648.  
  5649.       The _answerback_str system variable holds the string which Telix
  5650.       will send when a Ctrl-E (ENQ) character is received while in termi-
  5651.       nal mode. If this string is empty, nothing is sent. Note that if
  5652.       Compuserve B transfers are enabled, the answerback string will not
  5653.       be sent, since CIS B uses the Ctrl-E as part of the transfer pro-
  5654.       cess. Maximum length is 19 characters.
  5655.           Telix v3.00 - SALT Programming        System Variables    113
  5656.  
  5657.  
  5658.  
  5659.  
  5660.                                                                              _________________________________________________________________
  5661.  
  5662.       _asc_rcrtrans - _asc_striph
  5663.  
  5664.       o  Summary
  5665.  
  5666.       int _asc_rcrtrans;
  5667.  
  5668.       int _asc_remabort;
  5669.  
  5670.       int _asc_rlftrans;
  5671.  
  5672.       int _asc_scpacing;
  5673.  
  5674.       int _asc_scrtrans;
  5675.  
  5676.       int _asc_secho;
  5677.  
  5678.       int _asc_sexpand;
  5679.  
  5680.       int _asc_slftrans;
  5681.  
  5682.       int _asc_slpacing;
  5683.  
  5684.       int _asc_spacechr;
  5685.  
  5686.       int _asc_striph;
  5687.  
  5688.       o  Description
  5689.  
  5690.       _asc_rcrtrans determines what Telix does with Carriage Return char-
  5691.       acters during ASCII receives. 0 = do nothing; 1 = strip; 2 = add
  5692.       Line Feed afterwards.
  5693.  
  5694.       _asc_remabort is the character which when received from the remote
  5695.       side during an ASCII transfer is a signal to abort the transfer.
  5696.  
  5697.       _asc_rlftrans determines what Telix does with Line Feed characters
  5698.       during ASCII receives. 0 = do nothing; 1 = strip; 2 = add Carriage
  5699.       Return before.
  5700.  
  5701.       _asc_scpacing is the time in milliseconds which Telix should wait
  5702.       before transmitting each character during ASCII sends.
  5703.  
  5704.       _asc_scrtrans determines what Telix does with Carriage Return char-
  5705.       acters during ASCII sends. 0 = do nothing; 1 = strip; 2 = add Line
  5706.       Feed afterwards.
  5707.  
  5708.       If _asc_secho is set to non-zero (TRUE), Telix will echo each char-
  5709.       acter during ASCII sends.
  5710.  
  5711.       If _asc_sexpand is set to non-zero (TRUE), Telix will expand blank
  5712.       lines to a space character, during ASCII sends.
  5713.  
  5714.       _asc_slftran determines what Telix does with Line Feed characters
  5715.       during ASCII sends. 0 = do nothing; 1 = strip; 2 = add Carriage Re-
  5716.           Telix v3.00 - SALT Programming        System Variables    114
  5717.  
  5718.  
  5719.  
  5720.  
  5721.       turn before.
  5722.  
  5723.       _asc_slpacing is the time in tenths of seconds which Telix should
  5724.       wait before transmitting each line during ASCII sends.
  5725.  
  5726.       _asc_spacechr is the character which Telix should wait for during
  5727.       ASCII sends, before transmitting each line (0 means no wait).
  5728.  
  5729.       If _asc_striph is set to non-zero (TRUE), Telix will strip the high
  5730.       (most significant) bit of each character in an ASCII transfer.
  5731.  
  5732.                                                                              _________________________________________________________________
  5733.  
  5734.       _auto_ans_str
  5735.  
  5736.       o  Summary
  5737.  
  5738.       str _auto_ans_str[48];
  5739.  
  5740.       o  Description
  5741.  
  5742.       The _auto_ans_str system variable holds the string that should be
  5743.       sent to the modem to make it automatically answer the phone when it
  5744.       rings. This string is used by the Host Mode script, among others.
  5745.       The string will possibly include translation characters as described
  5746.       in the Telix manual in the section by that name, and should be sent
  5747.       to the modem with the cputs_tr function. Maximum length is 49 char-
  5748.       acters.
  5749.  
  5750.       o  See Also
  5751.  
  5752.       _mdm_init_string
  5753.  
  5754.                                                                              _________________________________________________________________
  5755.  
  5756.       _back_color
  5757.  
  5758.       o  Summary
  5759.  
  5760.       int _back_color;
  5761.  
  5762.       o  Description
  5763.  
  5764.       The _back_color system variable contains the background color which
  5765.       should be used for text in terminal mode. Allowable values are from
  5766.       0 - 15. Note that changes to this variable may not be reflected un-
  5767.       til the screen is cleared.
  5768.  
  5769.       o  See Also
  5770.  
  5771.       _fore_color
  5772.           Telix v3.00 - SALT Programming        System Variables    115
  5773.  
  5774.  
  5775.  
  5776.  
  5777.                                                                              _________________________________________________________________
  5778.  
  5779.       _capture_fname
  5780.  
  5781.       o  Summary
  5782.  
  5783.       str _capture_fname[64];
  5784.  
  5785.       o  Description
  5786.  
  5787.       The _capture_fname system variable holds the default capture file
  5788.       filename. The maximum length is 64 characters.
  5789.  
  5790.       o  See Also
  5791.  
  5792.       _usage_fname
  5793.  
  5794.                                                                              _________________________________________________________________
  5795.  
  5796.       _cisb_auto
  5797.  
  5798.       o  Summary
  5799.  
  5800.       int _cisb_auto;
  5801.  
  5802.       o  Description
  5803.  
  5804.       The _cisb_auto system variable controls whether Compuserve Quick B
  5805.       auto file transfer are allowed. If this variable is set to a 0
  5806.       (FALSE) value, requests by the remote (Compuserve) to transfer files
  5807.       using the Quick B protocol will be ignored.
  5808.  
  5809.       o  See Also
  5810.  
  5811.       _zmod_auto
  5812.  
  5813.                                                                              _________________________________________________________________
  5814.  
  5815.       _connect_str
  5816.  
  5817.       o  Summary
  5818.  
  5819.       str _connect_str[19];
  5820.  
  5821.       o  Description
  5822.  
  5823.       The _connect_str system variable holds the string which Telix should
  5824.       scan for when dialing, and should take to mean that a connection has
  5825.       been established. For Hayes type modems it is usually set to
  5826.       "CONNECT". Maximum length is 19 characters.
  5827.  
  5828.       o  See Also
  5829.  
  5830.       _no_connect1 - _no_connect4
  5831.           Telix v3.00 - SALT Programming        System Variables    116
  5832.  
  5833.  
  5834.  
  5835.  
  5836.                                                                              _________________________________________________________________
  5837.  
  5838.       _date_format
  5839.  
  5840.       o  Summary
  5841.  
  5842.       int _date_format;
  5843.  
  5844.       o  Description
  5845.  
  5846.       The contents of the _date_format system variable determines what
  5847.       format Telix uses for date strings it produces, as follows:
  5848.  
  5849.                      0    mm/dd/yy
  5850.                      1    dd/mm/yy
  5851.                      2    yy/mm/dd
  5852.  
  5853.       o  See Also
  5854.  
  5855.       _time_format
  5856.  
  5857.                                                                              _________________________________________________________________
  5858.  
  5859.       _dial_pause
  5860.  
  5861.       o  Summary
  5862.  
  5863.       int _dial_pause;
  5864.  
  5865.       o  Description
  5866.  
  5867.       The _dial_pause system variable holds (in seconds) the amount of
  5868.       time to wait between the end of one dialing attempt and the be-
  5869.       ginning of another. Most modems don't need more than a 1 second
  5870.       pause.
  5871.  
  5872.                                                                              _________________________________________________________________
  5873.  
  5874.       _dial_time
  5875.  
  5876.       o  Summary
  5877.  
  5878.       int _dial_time;
  5879.  
  5880.       o  Description
  5881.  
  5882.       The _dial_time system variable holds the amount of time Telix should
  5883.       wait for a connection when dialing, in seconds (e.g. 30).
  5884.  
  5885.       o  See Also
  5886.  
  5887.       _dial_pause
  5888.           Telix v3.00 - SALT Programming        System Variables    117
  5889.  
  5890.  
  5891.  
  5892.  
  5893.                                                                              _________________________________________________________________
  5894.  
  5895.       _dialpost
  5896.  
  5897.       o  Summary
  5898.  
  5899.       str _dialpost[19];
  5900.  
  5901.       o  Description
  5902.  
  5903.       The _dialpost system variable holds the string (the dialing postfix)
  5904.       which should be sent to the modem after the number, when dialing.
  5905.       For Hayes type modems, it is usually just a Carriage Return. Maximum
  5906.       length is 19 characters. This string will possibly include some
  5907.       translation characters, as described in the Telix manual, and should
  5908.       be sent to the modem with the cputs_tr function.
  5909.  
  5910.       o  See Also
  5911.  
  5912.       _dialpref, _dialpref2, _dialpref3, _redial_stop
  5913.  
  5914.                                                                              _________________________________________________________________
  5915.  
  5916.       _dialpref
  5917.  
  5918.       o  Summary
  5919.  
  5920.       str _dialpref[19];
  5921.  
  5922.       str _dialpref1[19];
  5923.  
  5924.       str _dialpref2[19];
  5925.  
  5926.       o  Description
  5927.  
  5928.       The _dialpref system variable holds the string which should be sent
  5929.       to the modem before the number, when dialing. For Hayes type modems,
  5930.       it is usually set to "ATDT". Maximum length is 19 characters. This
  5931.       string will possibly include translation characters, as described in
  5932.       the Telix manual, and should be sent to the modem with the cputs_tr
  5933.       function.
  5934.  
  5935.       The _dialpref2 and _dialpref3 are the other two dialing prefixes
  5936.       that may be defined in Telix.
  5937.  
  5938.       o  See Also
  5939.  
  5940.       _dialpost, _rdl_stop
  5941.           Telix v3.00 - SALT Programming        System Variables    118
  5942.  
  5943.  
  5944.  
  5945.  
  5946.                                                                              _________________________________________________________________
  5947.  
  5948.       _dir_prog
  5949.  
  5950.       o  Summary
  5951.  
  5952.       str _dir_prog[64];
  5953.  
  5954.       o  Description
  5955.  
  5956.       The _dir_prog system variable holds the name of the disk directory
  5957.       program that should be run when the user selects the 'Files direc-
  5958.       tory' option of the DOS Functions menu. If this variable is left
  5959.       empty (""), the DOS 'dir' command is used. Maximum length is 15
  5960.       characters.
  5961.  
  5962.                                                                              _________________________________________________________________
  5963.  
  5964.       _disp_free
  5965.  
  5966.       o  Summary
  5967.  
  5968.       int _disp_free
  5969.  
  5970.       o  Description
  5971.  
  5972.       If the _disp_free system variable is set to non-zero (TRUE), Telix
  5973.       will display the amount of free space available on the drive when
  5974.       the user presses Alt-R to download a file.
  5975.  
  5976.                                                                              _________________________________________________________________
  5977.  
  5978.       _down_dir
  5979.  
  5980.       o  Summary
  5981.  
  5982.       str _down_dir[64];
  5983.  
  5984.       o  Description
  5985.  
  5986.       The _down_dir system variable holds the default download directory
  5987.       name. When a file is downloaded (received), if the user specifies a
  5988.       drive and/or directory in the name, the file is put there. However,
  5989.       if only a name is specified, the file is placed in the directory in-
  5990.       dicated by _down_dir. The maximum length is 64 characters, and this
  5991.       string should end with the backslash character, '\'.
  5992.  
  5993.       o  See Also
  5994.  
  5995.       _up_dir, receive
  5996.           Telix v3.00 - SALT Programming        System Variables    119
  5997.  
  5998.  
  5999.  
  6000.  
  6001.                                                                              _________________________________________________________________
  6002.  
  6003.       _editor
  6004.  
  6005.       o  Summary
  6006.  
  6007.       str _editor[64];
  6008.  
  6009.       o  Description
  6010.  
  6011.       The _editor system variable holds the name of the editor that should
  6012.       be run when the user presses Alt-A. The editor should either be on
  6013.       the DOS Path, in which case only the name needs to be given, or else
  6014.       the entire pathname (drive, directory, name) must be given. The max-
  6015.       imum length is 64 characters. If a batch file is to be run the .BAT
  6016.       extension must be given.
  6017.  
  6018.                                                                              _________________________________________________________________
  6019.  
  6020.       _entry_enum
  6021.  
  6022.       o  Summary
  6023.  
  6024.       int _entry_enum;
  6025.  
  6026.       o  Description
  6027.  
  6028.       The _entry_enum variable is set by the dialing routines. When a con-
  6029.       nection is established while dialing, the entry number of the dial-
  6030.       ing directory entry connected to is stored here. If a manual number
  6031.       is connected to, the value 0 is stored here.
  6032.  
  6033.       o  See Also
  6034.  
  6035.       _entry_name
  6036.       dial, redial
  6037.           Telix v3.00 - SALT Programming        System Variables    120
  6038.  
  6039.  
  6040.  
  6041.  
  6042.                                                                              _________________________________________________________________
  6043.  
  6044.       _entry_name - _entry_pass
  6045.  
  6046.       o  Summary
  6047.  
  6048.       str _entry_name[29];
  6049.  
  6050.       str _entry_num[17];
  6051.  
  6052.       str _entry_pass[14];
  6053.  
  6054.       o  Description
  6055.  
  6056.       The _entry_name system variable is set by the dialing routines. When
  6057.       a connection has been established the name portion of the dialing
  6058.       directory entry connected to is copied here, for use by script
  6059.       files. The maximum length is 29 characters.
  6060.  
  6061.       The _entry_num system variable is set in the same way, and holds the
  6062.       phone number of the entry connected to. The maximum length is 17
  6063.       characters.
  6064.  
  6065.       The entry_pass system variable is set in the same way, and holds the
  6066.       password from the entry connected to. This may be used to perform
  6067.       logons. The maximum length is 14 characters.
  6068.  
  6069.       o  See Also
  6070.  
  6071.       _entry_enum
  6072.       dial, redial
  6073.  
  6074.                                                                              _________________________________________________________________
  6075.  
  6076.       _ext_filespec
  6077.  
  6078.       o  Summary
  6079.  
  6080.       str _ext_filespec[64];
  6081.  
  6082.       o  Description
  6083.  
  6084.       This variable is for use by scripts implementing external protocols.
  6085.       When an external protocol has been defined as called by a script,
  6086.       this variable is first loaded with the filespec (file specification)
  6087.       typed by the user at the transfer menu. The appropriate script is
  6088.       then run. The script can for example pass this name to a program
  6089.       which implements the actual protocol. Note that some file transfer
  6090.       protocols do not require the user to supply the name on downloads,
  6091.       in which case this variable is left empty.
  6092.           Telix v3.00 - SALT Programming        System Variables    121
  6093.  
  6094.  
  6095.  
  6096.  
  6097.                                                                              _________________________________________________________________
  6098.  
  6099.       _fore_color
  6100.  
  6101.       o  Summary
  6102.  
  6103.       int _fore_color;
  6104.  
  6105.       o  Description
  6106.  
  6107.       The _fore_color system variable contains the foreground color which
  6108.       should be used for text in terminal mode. Allowable values are from
  6109.       0 - 15. Note that changes to this variable may not be reflected un-
  6110.       til the screen is cleared.
  6111.  
  6112.       o  See Also
  6113.  
  6114.       _back_color
  6115.  
  6116.                                                                              _________________________________________________________________
  6117.  
  6118.       _image_file
  6119.  
  6120.       o  Summary
  6121.  
  6122.       str _image_file[64];
  6123.  
  6124.       o  Description
  6125.  
  6126.       The _image_file system variable holds the full name of the file that
  6127.       screen images are saved to when the user presses Alt-I while in ter-
  6128.       minal mode. If this file already exists, data is appended to it.
  6129.  
  6130.                                                                              _________________________________________________________________
  6131.  
  6132.       _local_echo
  6133.  
  6134.       o  Summary
  6135.  
  6136.       int _local_echo;
  6137.  
  6138.       o  Description
  6139.  
  6140.       The _local_echo system variable controls whether or not characters
  6141.       typed in terminal mode are echoed on the screen. If _local_echo is
  6142.       set to non-zero (TRUE), characters are echoed, otherwise they are
  6143.       not.
  6144.           Telix v3.00 - SALT Programming        System Variables    122
  6145.  
  6146.  
  6147.  
  6148.  
  6149.                                                                              _________________________________________________________________
  6150.  
  6151.       _mdm_hang
  6152.  
  6153.       o  Summary
  6154.  
  6155.       str _mdm_hang[19];
  6156.  
  6157.       o  Description
  6158.  
  6159.       The _mdm_hang system variable holds the string that should be sent
  6160.       to the modem to hang it up when the user presses Alt-H. Note that
  6161.       this string will only be sent to the modem if Telix can't first
  6162.       hang-up the modem by turning off a signal on the serial port called
  6163.       the DTR line. This string may contain translation characters as de-
  6164.       fined in the Telix manual, and should be sent to the modem with the
  6165.       cputs_tr function. Maximum length is 19 characters.
  6166.  
  6167.       o  See Also
  6168.  
  6169.       _mdm_init, _auto_ans_str
  6170.  
  6171.                                                                              _________________________________________________________________
  6172.  
  6173.       _mdm_init_str
  6174.  
  6175.       o  Summary
  6176.  
  6177.       str _mdm_init_str[49];
  6178.  
  6179.       o  Description
  6180.  
  6181.       The _modem_init system variable holds the string that should be sent
  6182.       to the modem when Telix starts-up. It is usually used to make sure
  6183.       certain settings in the modem are right. This string may contain
  6184.       translation characters as defined in the Telix manual, and should be
  6185.       sent to the modem with the cputs_tr function. Maximum length is 49
  6186.       characters.
  6187.  
  6188.       o  See Also
  6189.  
  6190.       _auto_ans_str, _mdm_hang
  6191.           Telix v3.00 - SALT Programming        System Variables    123
  6192.  
  6193.  
  6194.  
  6195.  
  6196.                                                                              _________________________________________________________________
  6197.  
  6198.       _no_connect1 - _no_connect4
  6199.  
  6200.       o  Summary
  6201.  
  6202.       str _no_connect1[19];
  6203.       str _no_connect2[19];
  6204.       str _no_connect3[19];
  6205.       str _no_connect4[19];
  6206.  
  6207.       o  Description
  6208.  
  6209.       These system variables contain the strings that Telix should scan
  6210.       for when dialing, and take to mean that a connection has not been
  6211.       established (i.e., the number was busy or there was no answer). The
  6212.       maximum length for each string is 19 characters.
  6213.  
  6214.       o  See Also
  6215.  
  6216.       _connect_str
  6217.  
  6218.                                                                              _________________________________________________________________
  6219.  
  6220.       _qdbar_on
  6221.  
  6222.       o  Summary
  6223.  
  6224.       int _qdbar_on;
  6225.  
  6226.       o  Description
  6227.  
  6228.       If the _qdbar_on system variable is set to non-zero (TRUE), the
  6229.       quick dialing bar is shown first when Alt-D is pressed; otherwise
  6230.       the user is taken directly to the dialing directory screen.
  6231.           Telix v3.00 - SALT Programming        System Variables    124
  6232.  
  6233.  
  6234.  
  6235.  
  6236.                                                                              _________________________________________________________________
  6237.  
  6238.       _redial_stop
  6239.  
  6240.       o  Summary
  6241.  
  6242.       str _redial_stop[19];
  6243.  
  6244.       o  Description
  6245.  
  6246.       The _redial_stop system variable holds the string that should be
  6247.       sent to the modem to stop a dialing attempt. It usually just holds a
  6248.       Carriage Return character. This string may contain translation
  6249.       characters as described in the Telix manual, and should be sent to
  6250.       the modem with the cputs_tr function. Maximum length is 19 charac-
  6251.       ters.
  6252.  
  6253.       o  See Also
  6254.  
  6255.       _dialpref, _dialpref2, _dialpref3, _dialpost
  6256.  
  6257.                                                                              _________________________________________________________________
  6258.  
  6259.       _scr_chk_key
  6260.  
  6261.       o  Summary
  6262.  
  6263.       int _scr_chk_key;
  6264.  
  6265.       o  Description
  6266.  
  6267.       Between every command while executing a script file, Telix checks
  6268.       the keyboard buffer to see if the user has requested an abort. This
  6269.       however gets in the way of the inkey function among others. As well,
  6270.       it is sometimes necessary to stop the user from being able to abort
  6271.       the script. If _scr_chk_key is set to zero (FALSE), Telix will no
  6272.       longer check for user aborts requests during script execution. Set-
  6273.       ting it back to non-zero (TRUE) will turn the checks back on. When
  6274.       modifying this variable in a script file, it is a good idea to save
  6275.       the old state in a scratch variable and restore it when done.
  6276.  
  6277.       o  See Also
  6278.  
  6279.       inkey
  6280.           Telix v3.00 - SALT Programming        System Variables    125
  6281.  
  6282.  
  6283.  
  6284.  
  6285.                                                                              _________________________________________________________________
  6286.  
  6287.       _script_dir
  6288.  
  6289.       o  Summary
  6290.  
  6291.       str _script_dir[64];
  6292.  
  6293.       o  Description
  6294.  
  6295.       The _script_dir system variable holds the full path of the directory
  6296.       where Telix should look for compiled script files when a script is
  6297.       selected to be run. When a script is selected to be run, Telix uses
  6298.       this procedure: if the name includes the drive and/or directory,
  6299.       only that path is searched. If the name includes only the filename,
  6300.       the current directory is first searched for the script file, and
  6301.       then the directory pointed to by the _script_dir variable. This
  6302.       string should end in the slash character, '\'. The maximum allowed
  6303.       length is 64 characters.
  6304.  
  6305.       o  See Also
  6306.  
  6307.       _telix_dir, _up_dir, _down_dir
  6308.  
  6309.                                                                              _________________________________________________________________
  6310.  
  6311.       _sound_on
  6312.  
  6313.       o  Summary
  6314.  
  6315.       int _sound_on;
  6316.  
  6317.       o  Description
  6318.  
  6319.       If the _sound_on system variable is set to non-zero (TRUE) sound is
  6320.       enabled in Telix, otherwise all sound is shut off.
  6321.  
  6322.       o  See Also
  6323.  
  6324.       _alarm_on
  6325.  
  6326.                                                                              _________________________________________________________________
  6327.  
  6328.       strip_high
  6329.  
  6330.       o  Summary
  6331.  
  6332.       int _strip_high;
  6333.  
  6334.       o  Description
  6335.  
  6336.       The _strip_high system variable controls what Telix does with the
  6337.       high (most significant) bit of incoming characters while in terminal
  6338.       mode. If this variable is set to s non-zero (TRUE) value, Telix will
  6339.       strip the high bit of incoming characters.
  6340.           Telix v3.00 - SALT Programming        System Variables    126
  6341.  
  6342.  
  6343.  
  6344.  
  6345.                                                                              _________________________________________________________________
  6346.  
  6347.       _swap_bs
  6348.  
  6349.       o  Summary
  6350.  
  6351.       int _swap_bs;
  6352.  
  6353.       o  Description
  6354.  
  6355.       The _swap_bs system variable controls what Telix sends when the
  6356.       Backspace key is pressed. If this variable is 0, Telix will send a
  6357.       Backspace character when Backspace is pressed, and a DEL character
  6358.       when Ctrl-Backspace is pressed. If this variable is set to 1, Telix
  6359.       will reverse these codes.
  6360.  
  6361.       o  See Also
  6362.  
  6363.       _dest_bs
  6364.  
  6365.                                                                              _________________________________________________________________
  6366.  
  6367.       _telix_dir
  6368.  
  6369.       o  Summary
  6370.  
  6371.       str _telix_dir[64];
  6372.  
  6373.       o  Description
  6374.  
  6375.       The _telix_dir system variable holds the full path to reach the
  6376.       Telix program's base directory (e.g. 'C:\TELIX\'). Changing this
  6377.       variable is not recommended, as if a wrong value is used, Telix will
  6378.       probably not be able to find many needed files. The maximum length
  6379.       is 64 characters.
  6380.  
  6381.       If this variable is changed, it is imperative that a backslash char-
  6382.       acter, '\', is found at the end. Telix builds paths to many files by
  6383.       appending certain names to this string. If the slash is missing, it
  6384.       will cause many problems.
  6385.  
  6386.       o  See Also
  6387.  
  6388.       _script_dir, _up_dir, _down_dir
  6389.           Telix v3.00 - SALT Programming        System Variables    127
  6390.  
  6391.  
  6392.  
  6393.  
  6394.                                                                              _________________________________________________________________
  6395.  
  6396.       _time_format
  6397.  
  6398.       o  Summary
  6399.  
  6400.       int _time_format;
  6401.  
  6402.       o  Description
  6403.  
  6404.       The _time_format system variable determines what format Telix uses
  6405.       for time strings it produces. If _time_format is 0, Telix will use a
  6406.       12 hour format, otherwise a 24 hour format will be used.
  6407.  
  6408.       o  See Also
  6409.  
  6410.       _date_format
  6411.  
  6412.                                                                              _________________________________________________________________
  6413.  
  6414.       _up_dir
  6415.  
  6416.       o  Summary
  6417.  
  6418.       str _up_dir[64];
  6419.  
  6420.       o  Description
  6421.  
  6422.       The _up_dir system variable holds the default upload directory name.
  6423.       When a file is to be ed (sent), if the user specifies a drive and/or
  6424.       directory in the name, the file is taken from there. However, if
  6425.       only a name is specified, the file is searched for in the directory
  6426.       indicated by _up_dir. This variable should end with a slash charac-
  6427.       ter, '\'. The maximum length is 64 characters.
  6428.  
  6429.       o  See Also
  6430.  
  6431.       _down_dir
  6432.  
  6433.                                                                              _________________________________________________________________
  6434.  
  6435.       _usage_fname
  6436.  
  6437.       o  Summary
  6438.  
  6439.       str _usage_fname[64];
  6440.  
  6441.       o  Description
  6442.  
  6443.       The _usage_fname system variable holds the default Usage Log file-
  6444.       name. The maximum length is 64 characters.
  6445.  
  6446.       o  See Also
  6447.  
  6448.       _capture_fname
  6449.           Telix v3.00 - SALT Programming        System Variables    128
  6450.  
  6451.  
  6452.  
  6453.  
  6454.                                                                              _________________________________________________________________
  6455.  
  6456.       _zmod_auto
  6457.  
  6458.       o  Summary
  6459.  
  6460.       int _zmod_auto;
  6461.  
  6462.       o  Description
  6463.  
  6464.       The _zmod_auto system variable controls whether or not Zmodem auto-
  6465.       downloads are allowed. If Telix is in terminal mode and receives an
  6466.       auto download request Telix will ignore it if this variable is set
  6467.       to a 0 (FALSE) value (however, the user can still receive the file
  6468.       by manually selecting the Zmodem protocol from the Alt-R menu).
  6469.  
  6470.       o  See Also
  6471.  
  6472.       _cisb_auto
  6473.  
  6474.                                                                              _________________________________________________________________
  6475.  
  6476.       _zmod_rcrash
  6477.  
  6478.       o  Summary
  6479.  
  6480.       int _zmod_rcrash;
  6481.  
  6482.       o  Description
  6483.  
  6484.       The _zmod_rcrash system variable controls whether the Zmodem receive
  6485.       Crash Recovery (resume) option is on. If this variable is set to a
  6486.       non-zero (TRUE) value, Telix will try to resume aborted transfers
  6487.       during a Zmodem download.
  6488.  
  6489.       o  See Also
  6490.  
  6491.       _zmod_scrash
  6492.           Telix v3.00 - SALT Programming        System Variables    129
  6493.  
  6494.  
  6495.  
  6496.  
  6497.                                                                              _________________________________________________________________
  6498.  
  6499.       _zmod_scrash
  6500.  
  6501.       o  Summary
  6502.  
  6503.       int _zmod_scrash;
  6504.  
  6505.       o  Description
  6506.  
  6507.       The _zmod_scrash system variable controls whether the Zmodem send
  6508.       Crash Recovery (resume) option is on. If this variable is set to a
  6509.       non-zero (TRUE) value, Telix will try to tell the other side to re-
  6510.       sume aborted transfers during a Zmodem upload.
  6511.  
  6512.       o  See Also
  6513.  
  6514.       _zmod_rcrash
  6515.           Telix v3.00                                 Appendix A    130
  6516.  
  6517.  
  6518.  
  6519.  
  6520.       6.  APPENDIX A - ASCII CHARACTER SET
  6521.  
  6522.       The ASCII character set consists if 128 characters, with each char-
  6523.       acter having an ASCII value, in the range of 0 to 127. The IBM PC
  6524.       uses the IBM Extended ASCII set, which adds a further 128 values, to
  6525.       provide extra symbols. The following table lists the regular ASCII
  6526.       character set. The first column contains the ASCII control charac-
  6527.       ters, which can not normally be printed, and are given by name.
  6528.  
  6529.       Dec Hex Ctrl Name    Dec Hex Chr   Dec Hex Chr     Dec Hex Chr
  6530.  
  6531.         0  00  ^@  NUL      32  20         64  40  @      96  60  `
  6532.         1  01  ^A  SOH      33  21  !      65  41  A      97  61  a
  6533.         2  02  ^B  STX      34  22  "      66  42  B      98  62  b
  6534.         3  03  ^C  ETX      35  23  #      67  43  C      99  63  c
  6535.         4  04  ^D  EOT      36  24  $      68  44  D     100  64  d
  6536.         5  05  ^E  ENQ      37  25  %      69  45  E     101  65  e
  6537.         6  06  ^F  ACK      38  26  &      70  46  F     102  66  f
  6538.         7  07  ^G  BEL      39  27  '      71  47  G     103  67  g
  6539.         8  08  ^H  BS       40  28  (      72  48  H     104  68  h
  6540.         9  09  ^I  HT       41  29  )      73  49  I     105  69  i
  6541.        10  0a  ^J  LF       42  2a  *      74  4a  J     106  6a  j
  6542.        11  0b  ^K  VT       43  2b  +      75  4b  K     107  6b  k
  6543.        12  0c  ^L  FF       44  2c  ,      76  4c  L     108  6c  l
  6544.        13  0d  ^M  CR       45  2d  -      77  4d  M     109  6d  m
  6545.        14  0e  ^N  SO       46  2e  .      78  4e  N     110  6e  n
  6546.        15  0f  ^O  SI       47  2f  /      79  4f  O     111  6f  o
  6547.        16  10  ^P  DLE      48  30  0      80  50  P     112  70  p
  6548.        17  11  ^Q  DC1      49  31  1      81  51  Q     113  71  q
  6549.        18  12  ^R  DC2      50  32  2      82  52  R     114  72  r
  6550.        19  13  ^S  DC3      51  33  3      83  53  S     115  73  s
  6551.        20  14  ^T  DC4      52  34  4      84  54  T     116  74  t
  6552.        21  15  ^U  NAK      53  35  5      85  55  U     117  75  u
  6553.        22  16  ^V  SYN      54  36  6      86  56  V     118  76  v
  6554.        23  17  ^W  ETB      55  37  7      87  57  W     119  77  w
  6555.        24  18  ^X  CAN      56  38  8      88  58  X     120  78  x
  6556.        25  19  ^Y  EM       57  39  9      89  59  Y     121  79  y
  6557.        26  1a  ^Z  SUB      58  3a  :      90  5a  Z     122  7a  z
  6558.        27  1b  ^[  ESC      59  3b  ;      91  5b  [     123  7b  {
  6559.        28  1c  ^\  FS       60  3c  <      92  5c  \     124  7c  |
  6560.        29  1d  ^]  GS       61  3d  =      93  5d  ]     125  7d  }
  6561.        30  1e  ^^  RS       62  3e  >      94  5e  ^     126  7e  ~
  6562.        31  1f  ^_  US       63  3f  ?      95  5f  _     127  7f DEL
  6563.       
  6564.           Telix v3.00                                 Appendix B    131
  6565.  
  6566.  
  6567.  
  6568.  
  6569.       7.  APPENDIX B - EXTENDED KEY SCAN CODES
  6570.  
  6571.       The following chart lists keyboard scan codes for special non-ASCII
  6572.       keys, as returned by inkey and inkeyw, and used by the keyget, key-
  6573.       set, keyload, and keysave SALT functions. Normal keys which are
  6574.       within the ASCII set are listed in the preceding appendix.
  6575.  
  6576.       
  6577.       Key      Normal        w / Ctrl        w / Alt       w / Shift
  6578.              Dec     Hex    Dec     Hex    Dec     Hex    Dec     Hex
  6579.       ---------------------------------------------------------------
  6580.       F1     15104  3b00    24064  5e00    26624  6800    21504  5400
  6581.       F2     15360  3c00    24320  5f00    26880  6900    21760  5500
  6582.       F3     15616  3d00    24576  6000    27136  6a00    22016  5600
  6583.       F4     15872  3e00    24832  6100    27392  6b00    22272  5700
  6584.       F5     16128  3f00    25088  6200    27648  6c00    22528  5800
  6585.       F6     16384  4000    25344  6300    27904  6d00    22784  5900
  6586.       F7     16640  4100    25600  6400    28160  6e00    23040  5a00
  6587.       F8     16896  4200    25856  6500    28416  6f00    23296  5b00
  6588.       F9     17152  4300    26112  6600    28672  7000    23552  5c00
  6589.       F10    17408  4400    26368  6700    28928  7100    23808  5d00
  6590.       ---------------------------------------------------------------
  6591.       1                                    30720  7800
  6592.       2                                    30976  7900
  6593.       3                                    31232  7a00
  6594.       4                                    31488  7b00
  6595.       5                                    31744  7c00
  6596.       6                                    32000  7d00
  6597.       7                                    32256  7e00
  6598.       8                                    32512  7f00
  6599.       9                                    32768  8000
  6600.       10                                   33024  8100
  6601.       ---------------------------------------------------------------
  6602.       Up     18432  4800
  6603.       Down   20480  5000
  6604.       Left   19200  4b00    29440  7300
  6605.       Right  19712  4d00    29696  7400
  6606.       Home   18176  4700    30464  7700
  6607.       End    20224  4f00    29952  7500
  6608.       PgUp   18688  4900    33792  8400
  6609.       PgDn   20736  5100    30208  7600
  6610.       Ins    20992  5200
  6611.       Del    21248  5300
  6612.       ---------------------------------------------------------------
  6613.       
  6614.           Telix v3.00                                 Appendix C    132
  6615.  
  6616.  
  6617.  
  6618.  
  6619.       8.  APPENDIX C - COLOR VALUES
  6620.  
  6621.       Several SALT functions, such as pstra, use color attribute values. A
  6622.       character on the text screen has a foreground color, and a back-
  6623.       ground color. Possible colors are numbered as follows:
  6624.  
  6625.                           Black          00
  6626.                           Blue           01
  6627.                           Green          02
  6628.                           Cyan           03
  6629.                           Red            04
  6630.                           Magenta        05
  6631.                           Brown          06
  6632.                           Light Grey     07
  6633.                           Dark Grey      08
  6634.                           Light Blue     09
  6635.                           Light Green    10
  6636.                           Light Cyan     11
  6637.                           Light Red      12
  6638.                           Light Magenta  13
  6639.                           Yellow         14
  6640.                           White          15
  6641.       
  6642.       To obtain a color attribute value for a color combination, the for-
  6643.       mula is
  6644.  
  6645.            color attribute value =
  6646.  
  6647.                  foreground color value + (16 * background color value)
  6648.  
  6649.       Therefore, a Yellow character on a Blue background would have a
  6650.       color attribute value of 30 (14 + (16 * 1)).
  6651.           Telix v3.00 - SALT Programming                   Index    133
  6652.  
  6653.  
  6654.  
  6655.  
  6656.                                                 Capture_stat  27
  6657.                                           Carrier  27
  6658.                                           Chatmode  28
  6659.       9.  INDEX                                          Cinp_cnt  28
  6660.                                           Clear_scr  30
  6661.       _add_lf  112                                          Copychrs  30
  6662.       _alarm_on  112                                          Copystr  31
  6663.       _answerback_str  112                                          Cputc  32
  6664.       _back_color  114                                          Cputs  33
  6665.       _capture_fname  115                                          Cputs_tr  33
  6666.       _cisb_auto  115                                          Cursor_onoff  34
  6667.       _connect_str  115                                          Date  35
  6668.       _date_format  116                                          Delay  36
  6669.       _dial_pause  116                                          Delay_scr  36
  6670.       _dial_time  116                                          Dial  37
  6671.       _dialpost  117                                          Dos  38
  6672.       _dialpref  117                                          Dosfunction  39
  6673.       _dialpref1  117                                          Exittelix  39
  6674.       _dialpref2  117                                          Fclearerr  40
  6675.       _dir_prog  118                                          Fclose  40
  6676.       _disp_free  118                                          Feof  41
  6677.       _down_dir  118                                          Ferror  42
  6678.       _editor  119                                          Fflush  42
  6679.       _entry_enum  119                                          Fgetc  43
  6680.       _entry_name  120                                          Fgets  44
  6681.       _entry_num  120                                          Fileattr  45
  6682.       _entry_pass  120                                          Filefind  47
  6683.       _ext_filespec  120                                          Filesize  48
  6684.       _fore_color  121                                          Filetime  49
  6685.       _image_file  121                                          Flushbuf  50
  6686.       _local_echo  121                                          Fnstrip  51
  6687.       _mdm_hang  122                                          Fopen  52
  6688.       _mdm_init_str  122                                          Fputc  53
  6689.       _no_connect1  123                                          Fputs  53
  6690.       _no_connect2  123                                          Fread  54
  6691.       _no_connect3  123                                          Fseek  55
  6692.       _no_connect4  123                                          Ftell  56
  6693.       _qdbar_on  123                                          Fwrite  56
  6694.       _redial_stop  124                                          Get_baud  57
  6695.       _scr_chk_key  124                                          Get_datab  57
  6696.       _script_dir  125                                          Get_parity  58
  6697.       _sound_on  125                                          Get_port  58
  6698.       _swap_bs  126                                          Get_stopb  59
  6699.       _telix_dir  126                                          Gets  59
  6700.       _time_format  127                                          Getsxy  60
  6701.       _up_dir  127                                          Gotoxy  61
  6702.       _usage_fname  127                                          Hangup  62
  6703.       _zmod_auto  128                                          Helpscreen  62
  6704.       _zmod_rcrash  128                                          Inschrs  64
  6705.       _zmod_scrash  129                                          Is_loaded  66
  6706.       Alarm  23                                          Isalnum  65
  6707.       Box  24                                          Iscntrl  65
  6708.       Call  25                                          Isdigit  65
  6709.       Calld  25                                          Islower  65
  6710.       Capture  26                                          Isupper  65
  6711.           Telix v3.00 - SALT Programming                   Index    134
  6712.  
  6713.  
  6714.  
  6715.  
  6716.       Itos  66                                          Toupper  101
  6717.       Keyget  67                                          Track  102
  6718.       Keyload  68                                          Track_addchr  102
  6719.       Keysave  68                                          Track_free  102
  6720.       Keyset  69                                          Track_hit  102
  6721.       Load_scr  70                                          Transtab  104
  6722.       Loadfon  70                                          Tsec  95
  6723.       Newdir  71                                          Tyear  95
  6724.       Printc  71                                          Update_term  104
  6725.       Printn  73                                          Usage_stat  109
  6726.       Prints  74                                          Usagelog  109
  6727.       Printsc  74                                          Ustamp  110
  6728.       Printsc_trm  74                                          Waitfor  108
  6729.       Pstra  75
  6730.       Pstraxy  75
  6731.       Receive  76
  6732.       Redial  77
  6733.       Run  78
  6734.       Scroll  79
  6735.       Send  80
  6736.       Send_brk  81
  6737.       Set_cparams  81
  6738.       Set_defprot  82
  6739.       Set_port  83
  6740.       Set_terminal  84
  6741.       Setchr  82
  6742.       Setchrs  83
  6743.       Show_directory  85
  6744.       Stoi  86
  6745.       Strcat  87
  6746.       Strchr  88
  6747.       Strcmpi  89
  6748.       Strip_high  125
  6749.       Strlen  89
  6750.       Strlower  90
  6751.       Strmaxlen  90
  6752.       Strpos  91
  6753.       Strposi  91
  6754.       Strupper  91
  6755.       Subchr  92
  6756.       Subchrs  93
  6757.       Substr  93
  6758.       Tday  95
  6759.       Terminal  96
  6760.       Thour  95
  6761.       Time  97
  6762.       Time_up  99
  6763.       Timer_free  99
  6764.       Timer_restart  99
  6765.       Timer_start  99
  6766.       Timer_total  99
  6767.       Tmin  95
  6768.       Tmonth  95
  6769.       Tolower  100
  6770.       Tone  101